NEW
Font size
WorksheetsWeb JavaScript
Total questions: 15
Worksheet time: 8mins
What is the value of:
”41” + 1
42
“42”
411
“411”
What is the extension for a JavaScript file?
.java
.jar
.js
.sj
What is the name of the JavaScript standard?
JavaScript
ECMAScript
JS
PEP
What is the correct syntax for referring to an external JavaScript script?
<script src="myscript.js"></script>
<script href="myscript.js"></script>
<js href="myscript.js"></js>
<js src="myscript.js"></js>
Which of these is a loop?
if(x<10)
while(x<10)
var x=10;
text(x,10;10)
His name is Fred and he is less than 16 years old
Which of the following is the best way to write the above statement?
if (name = "fred" && age < 16 )
if (name == "fred" && age < 16 )
if (name = "fred" || age < 16 )
if (name == "fred" || age < 16 )
Which of the following methods can be used to display data in some form using Javascript?
document. write()
console.log()
window.alert()
All of the above
Which of the following keywords is used to define a variable in Javascript?
Var
Let
Both Var and Let
None of the above
How would you change the first element in an array?
nums[1] = "New!";
nums = "New!";
var nums[1] = "New!";
nums[0] = "New!";
Which of these are correct methods to create a function?
function myFunction {
// Some code }
function myFunction[] {
// Some code }
function myFunction() {
// Some code }
def myFunction(x, y, z) {
// Some code }
Given the following code, what is the final value of x?
var x = 0;
function myXFunction() {
x = x + 10;
}
x = x + 1;
11
0
10
1
What will the final value of x be?
var x = 0;
function myXFunction() {
return 10;
}
x = x + 1;
x = myXFunction();
11
0
10
1
const [b,c,a] = "abc"
Value of c?
a
b
c
null
