JavaScript is a versatile, dynamic programming language that is a fundamental part of modern web development. Initially created to add interactivity to static HTML pages, JavaScript has evolved into a powerful tool that can be used both on the client and server sides.
Our flashcard app includes 170 carefully selected JavaScript interview questions with comprehensive answers that will effectively prepare you for any interview requiring JS knowledge. IT Flashcards is not just a tool for job seekers - it's a great way to reinforce and test your knowledge, regardless of your current career plans. Regular use of the app will help you stay up-to-date with the latest JavaScript trends and keep your skills at a high level.
Download our app from the App Store or Google Play to get more free flashcards or subscribe for access to all flashcards.
function outerFunction() {
let outerVariable = `I'm outside!`;
function innerFunction() {
console.log(outerVariable); // Has access to the 'outerVariable'
}
innerFunction();
}
outerFunction(); // Displays `I'm outside!`
console.log(myVar); // undefined
var myVar = 5;
console.log(myVar); // 5
console.log(myFunction()); // "Hello World"
function myFunction() {
return "Hello World";
}
function sum(a, b) {
return a + b;
}
const sum = (a, b) => a + b;
const promise = new Promise((resolve, reject) => {
const success = true;
if (success) {
resolve('Operation successful.');
} else {
reject('Operation failed.');
}
});
promise
.then(result => {
console.log(result); // Will print: 'Operation successful.'
})
.catch(error => {
console.log(error);
});
function executeAfterTimeout(callback, timeout) {
setTimeout(() => {
console.log('Time passed!');
callback();
}, timeout);
}
executeAfterTimeout(() => {
console.log('This is a callback!');
}, 2000);
let value = null ?? 'default value';
let value1 = 0 || 'default';
console.log(value1); // output: 'default' because 0 is a false value
let value2 = 0 ?? 'default';
console.log(value2); // output: 0 because 0 is not null or undefined
const symbol1 = Symbol('mySymbol');
const symbol2 = Symbol('mySymbol');
console.log(symbol1 === symbol2); // returns false
let obj = {};
let privateProperty = Symbol('private');
obj[privateProperty] = 'This is private';
console.log(obj[privateProperty]); // 'This is private'
console.log(Object.keys(obj)); // []
let john = { name: "John" };
let weakMap = new WeakMap();
weakMap.set(john, "...");
john = null; // overwrite the reference
// john is removed from memory!
let john = { name: "John" };
let weakSet = new WeakSet();
weakSet.add(john);
john = null; // overwrite the reference
// john is removed from memory!
Expand your JavaScript knowledge with our flashcards.
From basic programming principles to mastering advanced technologies, IT Flashcards is your passport to IT excellence.
Download now and unlock your potential in today's competitive tech landscape.