Skip to content

Instantly share code, notes, and snippets.

@salami-art
Created January 16, 2021 13:12
Show Gist options
  • Save salami-art/5c8f610a44cd6f1a0ac6b048a1546643 to your computer and use it in GitHub Desktop.
Save salami-art/5c8f610a44cd6f1a0ac6b048a1546643 to your computer and use it in GitHub Desktop.
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);
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