Which of the following correctly declares a constant variable PI
with the value 3.14 in JavaScript?
What exactly does "Execution Context" mean in JavaScript?
Code block for function declarations
Environment for executing JavaScript code
Global object in the browser
What happens when variable shadowing occurs in JavaScript?
A local variable hides a global variable with the same name
A function is unable to access global variables
Variables are reset to default values
JavaScript automatically changes the value of the variable.
What will be the output of the following JavaScript code snippet?
let y = 30;
if (true) {
let y = 40;
console.log(y);
}
console.log(y);
What will be the output of this JavaScript code?
JavaScript
let a = 5;
function test() {
let a = 10;
console.log(a);
}
test();
console.log(a);
What will happen when this code runs?
HTML
<html>
<body>
<script>
let userName = prompt("Enter your name:");
alert("Your name is: " + userName);
</script>
</body>
</html>
A pop-up displays "Your name is: [user's input]"
The name is printed in the browser console
The webpage content is updated with "Your name is: [user's input]"
Which of the following is true about the let keyword?
It is block-scoped and cannot be redeclared in the same scope
It can be redeclared within the same scope
It is hoisted to the top like var
What will happen when this code is executed?
JavaScript
function greet(name) {
return "Hello, " + name;
}
console.log(greet("Alisha"));
The function will greet the name "Alisha"
The code will result in an error
"Hello, Alisha" will be logged in the console
Consider the const
declaration for an array:
const arr = [10, 20, 30];
arr[1] = 25;
console.log(arr);
What will be the output of the console.log(arr)
statement?
TypeError: Assignment to constant variable.
JavaScript is a single-threaded language. What does that mean?
It can execute multiple tasks at once
It can only execute one task at a time
It doesn’t need any external libraries
It runs in multiple browsers simultaneously.
There are 10 questions to complete.
Take a part in the ongoing discussion
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4