Created
January 16, 2021 13:12
-
-
Save salami-art/5c8f610a44cd6f1a0ac6b048a1546643 to your computer and use it in GitHub Desktop.
This file contains 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
function numericValue() { | |
if (stringValue === "one") { | |
numericValue = 1; | |
} else if (stringValue === "two") { | |
numericValue = 2; | |
} else if (stringValue === "three") { | |
numericValue = 3; | |
} | |
} | |
let someObject = { | |
someBoolean: true, | |
someString: "This is a dummy object", | |
someNumber: numericValue("two") | |
}; | |
console.log(someObject); |
This file contains 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
let stringValue = "two"; | |
let numericValue; | |
if (stringValue === "one") { | |
numericValue = 1; | |
} else if (stringValue === "two") { | |
numericValue = 2; | |
} else if (stringValue === "three") { | |
numericValue = 3; | |
} | |
let someObject = { | |
someBoolean: true, | |
someString: "This is a dummy object", | |
someNumber: numericValue | |
}; | |
console.log(someObject); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment