-
-
Save mmloveaa/a2dfcc7deadee30d3f6ce3c22621d8b8 to your computer and use it in GitHub Desktop.
4-6
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
Q14 | |
var words = ['one', 'two', 'three']; | |
var x = words.forEach(function(word) { | |
return word.toUpperCase(); | |
}); | |
x==> undefined | |
Q17 | |
Suppose a webpage contains a single text field. We want to make the page such that a user can immediately start typing in the text field without clicking on it. What is correct way using HTML5? | |
PICK ONE OF THE CHOICES | |
<input type="text" focus=True> | |
<input type="text" autofocus> | |
<input type="text" focus=onPageLoad> | |
Can't be done with only HTML5, need help of Javascript or something else. | |
Q20 | |
Which of the following javascript functions perform the given tasks correctly? | |
The function takes one numeric variable as parameter. | |
If the variable is 0 than it creates a dialogue box which says "zero". | |
If the variable is 1 than it creates a dialogue box which says "one". | |
Otherwise it creates a dialogue box which says "Invalid input". | |
PICK ONE OF THE CHOICES | |
function myFunction(value) { | |
switch (value) { | |
case 0: | |
str = "zero"; | |
break; | |
case 1: | |
str = "one"; | |
break; | |
default: | |
str = "Invalid input"; | |
break; | |
} | |
return alert(str); | |
} | |
function myFunction(value) { | |
switch (value) { | |
case 0: | |
str = "zero"; | |
case 1: | |
str = "one"; | |
default: | |
str = "Invalid input"; | |
} | |
alert(str); | |
} | |
function myFunction(value) { | |
switch (value) { | |
case "0": | |
str = "zero"; | |
break; | |
case "1": | |
str = "one"; | |
break; | |
default: | |
str = "Invalid input"; | |
break; | |
} | |
alert(str); | |
} | |
function myFunction(value) { | |
switch (value) { | |
case 0: | |
str = "zero"; | |
break; | |
case 1: | |
str = "one"; | |
break; | |
default: | |
str = "Invalid input"; | |
break; | |
} | |
alert(str); | |
} | |
Clear selection | |
Q24 | |
// 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