Skip to content

Instantly share code, notes, and snippets.

@mmloveaa
Created April 6, 2016 19:15
Show Gist options
  • Save mmloveaa/f281fa1e5f478927f956cca8e28fba08 to your computer and use it in GitHub Desktop.
Save mmloveaa/f281fa1e5f478927f956cca8e28fba08 to your computer and use it in GitHub Desktop.
Q1-3
var x = 100;
function test() {
if(false) {
var x = 199;
}
console.log(x);
}
test();
// What is the value of x after the following code executes?
var chars = ["1", "2", "3"];
var x = chars.reduce(function(a, b){
return a + b;
});
console.log(x)
console.log(typeof(x))
// function test() {
// if("peanut butter" && "jelly"){
// return 1+3;
// }else {
// return false
// }
// }
// test();
function test() {
if("2" == 2){
return 5+6;
}else {
return false
}
}
test();
// function test() {
// if("yes" || true){
// return 3+3;
// } else {
// return false
// }
// }
// test();
// function test() {
// if(NaN !== NaN){
// return 1+1;
// } else {
// return false
// }
// }
// test();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment