Created
July 8, 2019 23:58
-
-
Save methodbox/5684433fd3b5c40b5b55c636a5a81c90 to your computer and use it in GitHub Desktop.
typof example
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
let myNumber = 10; | |
let myString = 'this is a string'; | |
if (typeof myNumber === 'string') { | |
console.log('This is a string, not a number.') | |
} else { | |
console.log('This is a number'); | |
} | |
const badMath = (x, y) => { | |
return x * y; | |
} | |
badMath(myNumber, myString) // Output is NaN because myString isn't a number. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment