Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Statische Variable in Funktionen

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Statische Variable in Funktionen

    This topic has been deleted. Only users with topic management privileges can see it.
    • hanss
      hanss last edited by

      Hallo,
      gibt es in js auch Statische Variable wie z.B. in Arduino C++?
      Beispiel :

      function test(){
        static let xyz_old 
        if (xyz_old == 0){
           xyz_old = 5
        } else {
         if (xyz_old == 5){
             xyz_old = 0
          }
       }
      }
      

      Vielen Dank

      E 1 Reply Last reply Reply Quote 0
      • E
        ente34 @hanss last edited by

        @hanss
        siehe hier

        Gut gefallen hat mir

        function countMyself() {
            // Check to see if the counter has been initialized
            if ( typeof countMyself.counter == 'undefined' ) {
                // It has not... perform the initialization
                countMyself.counter = 0;
            }
        
            // Do something stupid to indicate the value
            alert(++countMyself.counter);
        }
        
        1 Reply Last reply Reply Quote 1
        • First post
          Last post

        Support us

        ioBroker
        Community Adapters
        Donate

        890
        Online

        31.8k
        Users

        80.0k
        Topics

        1.3m
        Posts

        javascript
        2
        2
        275
        Loading More Posts
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes
        Reply
        • Reply as topic
        Log in to reply
        Community
        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
        The ioBroker Community 2014-2023
        logo