Created
July 3, 2022 19:07
-
-
Save batazo/627b2ff23b475b7de51767e28f878ece to your computer and use it in GitHub Desktop.
STATIC FIELDS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Translator { | |
static translations = { | |
yes: 'ja', | |
no: 'nein', | |
maybe: 'vielleicht', | |
}; | |
static englishWords = []; | |
static germanWords = []; | |
static { // (A) | |
for (const [english, german] of Object.entries(this.translations)) { | |
this.englishWords.push(english); | |
this.germanWords.push(german); | |
} | |
} | |
} | |
console.log(Translator.englishWords, Translator.germanWords) | |
//Output -> ["yes", "no", "maybe"], ["ja", "nein", "vielleicht"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment