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
9. What is the output of the following code? console.log(typeof NaN);
Anonymous Quiz
18%
A) object
27%
B) undefined
45%
C) number
9%
D) NaN
10. What is the purpose of the this keyword in JavaScript?
Anonymous Quiz
71%
A) Refers to the current function's parameters.
29%
B) Refers to the object in which the function was called.
0%
C) Refers to the global object, regardless of the context.
0%
D) Refers to the last variable declared in the script.
π : Spread the Love! Cloning Arrays Made Easy π
Want to create a quick copy of an array? Use the spread operator (...)! It's super simple:
const originalArray = [1, 2, 3];
const clonedArray = [...originalArray];
console.log(clonedArray); // Output: [1, 2, 3]
β¨ Pro Tip: This creates a shallow copy, so the clonedArray is a fresh array, but if your original array has nested objects, they will still be linked! Keep that in mind for deep copies. π
#JavaScript #CodingTricks #SpreadOperator
What is a void operator? The void operator returns an undefined value from an evaluated expression, or in other words; the void operator specifies an expression to be evaluated without returning a value. It is commonly used in client-side JavaScript, where the browser should not display the value.
function getYear() {
return 2020;
};
console.log(getYear());
// Output: 2020
console.log(void getYear());
// Output: undefined
// Useful use case
button.onclick = () => void getYear();The Worldβs First Web Site
On August 6, 1991, without fanfare, British computer scientist Tim Berners-Lee published the first-ever website while working at CERN, the huge particle physics lab in Switzerland. https://info.cern.ch/hypertext/WWW/TheProject.html
On August 6, 1991, without fanfare, British computer scientist Tim Berners-Lee published the first-ever website while working at CERN, the huge particle physics lab in Switzerland. https://info.cern.ch/hypertext/WWW/TheProject.html
A community platform for developers to share knowledge. Dev.to is a developer-focused social platform where you can read blogs, share articles, and learn from the community. Itβs a great place for beginners and experienced developers alike to discuss new trends, tools, frameworks, and best practices. The platform also hosts discussions, coding tutorials, and personal experiences shared by developers all over the world.π
βCoding is the closest thing we have to a superpower.β
Drew Houston, the Founder of Dropbox
Good luck! πͺ
Dr. Chuck's Online Python for Everybody
The Course is one of the most popular and highly recommended free Python courses available online. It is designed for beginners who want to learn Python programming, and itβs known for its clarity, engaging style, and practical applications
π¨βπ» Calling all developers! π©βπ»
π₯ Here's some rare advice for all the junior developers struggling to get started! π₯
π
#simplecoding #codingtips #juniordevelopers #breakitdown π€π»
π₯ Here's some rare advice for all the junior developers struggling to get started! π₯
π
When you're faced with a coding problem, remember that less is often more! Don't overcomplicate your code by trying to fit too much logic into one line of code. Instead, break it down into simple, manageable pieces.
#simplecoding #codingtips #juniordevelopers #breakitdown π€π»
Android apps for learning coding
1. π©βπ»SoloLearn
Offers courses in Python, JavaScript, C++, and more.
Free with community support and quizzes
2. π Mimo
Bite-sized lessons in Python, HTML, CSS, etc.
Free with daily challenges
3.π§ Enki
Daily coding lessons on various languages.
Free with premium features.
Sololearn
Sololearn: Learn to Code
Join Now to learn the basics or advance your existing skills