π Welcome to Code.io! π
We're excited to have you here! π
This is your go-to space for everything coding-related. What to expect:
πΉ Daily Coding Challenges π§©
πΉ Programming Tips & Tutorials π
πΉ Tech News & Updates π
πΉ Community Support β Ask questions, share ideas, and collaborate! π Donβt forget to turn on notifications to stay updated on the latest content!
Letβs code, learn, and grow together! πͺ
β€1
1. What is the difference between var, let, and const in JavaScript?
Anonymous Quiz
8%
A)var is block-scoped, let is function-scoped, and const can be re-assigned.
83%
B)var is function-scoped, let is block-scoped, and const is constant and cannot be re-assigned.
0%
C)var and let are the same, but const is used only for objects.
8%
D)var, let, and const are all the same in terms of scope.
2. What will the following code log to the console?console.log(2 + '2');
Anonymous Quiz
69%
A) 22
15%
B) 4
8%
C) undefined
8%
D) Error
3. What does === do in JavaScript?
Anonymous Quiz
8%
A) Compares only values, ignoring the type.
67%
B) Compares both value and type
0%
C) Assigns values to variables.
25%
D) Returns a boolean indicating if two values are equal.
let a = 10;
function foo() {
a = 20; console.log(a); } foo(); console.log(a);
function foo() {
a = 20; console.log(a); } foo(); console.log(a);
Anonymous Quiz
22%
A) 10 and 10
56%
B) 20 and 10
22%
C) 20 and 20
0%
D) Error
5. What is a JavaScript closure?
Anonymous Quiz
0%
A) A function that defines a loop.
100%
B) A function that returns another function and retains access to the outer functionβs variables.
0%
C) A function that is used to close open tabs in a browser.
0%
D) A JavaScript method that allows for asynchronous operations.
6. What is null vs. undefined in JavaScript?
Anonymous Quiz
14%
A) null means an object, and undefined means no value.
14%
B) null is a variable that has not been initialized, and undefined is the absence of a value.
71%
C) null represents no value, and undefined means a variable is declared but not yet assigned.
0%
D) null and undefined are the same.
7. What will the following code output? const arr = [1, 2, 3];
arr[10] = 5;
console.log(arr);
arr[10] = 5;
console.log(arr);
Anonymous Quiz
14%
A) [1, 2, 3, 5]
57%
B) [1, 2, 3, <7 empty items>, 5]
14%
C) [1, 2, 3, 5, undefined]
14%
D) [1, 2, 3, undefined, 5]
8. How can you create a new object in JavaScript?
Anonymous Quiz
14%
A) let person = Object.create(null);
14%
B) let person = new Object();
43%
C) let person = { name: 'Alice', age: 25 };
29%
D) All of the above