WorksheetsFundamentals of JavaScript
Total questions: 10
Worksheet time: 5mins
What is the correct syntax to declare a variable in JavaScript?
let x = 5;
let x == 5;
var x = 5;
const x : 5;
Which of the following is a JavaScript data type?
boolean
integer
string
undefined
What does 'NaN' stand for in JavaScript?
Number-Not-Available
Not-a-Name
Null-Value
Not-a-Number
How do you create a function in JavaScript?
function:myFunction() { // function body }
function myFunction: { // function body }
function myFunction() { // function body } or const myFunction = () => { // function body }
myFunction() => { // function body }
What is the purpose of the 'this' keyword in JavaScript?
The 'this' keyword is used to refer to the current execution context or object.
The 'this' keyword is used to create new objects in JavaScript.
The 'this' keyword is a function that returns the current date.
The 'this' keyword is used to declare variables in JavaScript.
How can you add a comment in JavaScript?
Use // for single-line comments and /* comment */ for multi-line comments.
Use # for comments
Use for comments
Use // for multi-line comments only
What is the difference between '==' and '===' in JavaScript?
The difference is that '==' performs type coercion while '===' does not.
Both '==' and '===' perform type coercion.
'==' checks for strict equality while '===' checks for loose equality.
'==' and '===' are interchangeable operators.
Where is the correct place to insert a JavaScript?
The <head> section
The <body> section
both the <head> and <body> section are correct
Inside which HTML element do we put the JavaScript?
<script>
<javaScript>
<js>
<scripting>
What is the value of:
”41” + 1
42
“42”
411
“411”
