Font size
WorksheetsJS - Knowledge Check
Total questions: 14
Worksheet time: 31mins
Create a variable called carName, assign the value Volvo to it.
let ________ = "________"
(a)
Fill in the Blank( See Picture )
Display the sum of 5 + 10, using two variables: x and y.
(a)
Fill in the Blanks ( See Picture )
Create a variable called z, assign x + y to it, and display the result in an alert box.
(a)
Fill in the Blanks (See Picture)
On one single line, declare three variables with the following names and values:
firstName = "John"
lastName = "Doe"
age = 35
(a)
Fill in the Blanks ( See Picture )
Make the function return "Hello".
(a)
Fill in the Blanks ( See Picture )
Create a function called "myFunction".
(a)
What is the correct JavaScript syntax to change the content of the HTML element below?
<p id="demo">This is a demonstration.</p>
document.getElementByName("p").innerHTML = "Hello World!";
#demo.innerHTML = "Hello World!";
document.getElementById("demo").innerHTML = "Hello World!";
document.getElement("p").innerHTML = "Hello World!";
What will the following code output?
console.log(10 + "5");
15
105
TypeError
NaN
How do you write a conditional statement in JavaScript?
if i = 5 then
if (i == 5)
if i = 5
if i == 5 then
Which function is used to print something in the browser console?
console.print()
print()
log()
console.log()
How do you create a function in JavaScript?
function myFunction() {}
myFunction = function() {}
def myFunction():
create function myFunction() {}
Which method is used to add a new element at the end of an array?
push()
add()
append()
insertLast()
What does the following JavaScript code do?
var x = 85;
var y = "5";
var z = x + y;
Adds x and y together
Concatenates x and y
Multiplies x and y
Raises x to the power of y
Create A Function in JavaScript
create a function named add that takes two parameters a and b and returns their sum:
create a loop that prints numbers from 1 to 5
