Front End Job interview Tips Flashcards

1
Q

What are examples of falsy values?

A

In JavaScript, a value is considered falsy if it coerces to false when evaluated in a boolean context. Examples are 0, empty strings, etc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can you declare variables in Javascript?

A

There are three options, var, let and const.

Before VAR was used everywhere, but because of problems const and let were introduced.

Var can be both globally or locally scoped
Var variables can be re-declared and updated
Problem if you’re not awhere of reassigning var when its already globally used and the reassigned in block scope

With const you cannot re-assign values, while this is still possible with let.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What’s the difference between == and ===

A

=== more strict, compare value and type,
== compares only the value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What’s the difference between Undefined and Null?

A

The key difference between null and undefined is that undefined is often the default value for variables that haven’t been assigned any value, whereas null is a deliberate assignment to represent the intentional absence of a value.
In summary, undefined usually means “I haven’t set a value for this variable yet,” while null means “I’ve intentionally set this variable to have no value.” Both are used to handle different situations in your JavaScript code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What’s the spread operator? and what’s the Rest operator?

A

Imagine you have a basket of fruits, and you want to create a new basket that contains all the fruits from the original basket plus a new one. The spread operator in JavaScript is a bit like adding fruits to your basket.

In JavaScript, the spread operator is written as three dots (...). It’s a convenient way to take the elements from an iterable (like an array) and spread them into a new context, like another array or function arguments.

The rest operator in JavaScript is also represented by three dots (…), but its usage is a bit different from the spread operator. While the spread operator is used to spread elements, the rest operator is used to gather or collect multiple elements into a single variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What’s the function of Destructuring in Javascript?

A

Destructuring in JavaScript is a powerful feature that allows you to extract values from arrays or properties from objects and assign them to variables in a more concise and readable way. It simplifies the process of working with complex data structures

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are Promises in Javascript?

A

Promises in JavaScript are objects that represent the eventual completion or failure of an asynchronous operation and its resulting value. They are a way to handle asynchronous operations more effectively, providing a cleaner and more readable syntax compared to traditional callback functions.

A promise can be in one of three states:

Pending: The initial state, before the promise is fulfilled or rejected.
Fulfilled: The operation completed successfully, and the promise has a resulting value.
Rejected: The operation failed, and the promise has a reason for the failure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Explain Pass by value vs Pass by reference

A

Primitive data types (like numbers, strings, and booleans) are passed by value. Meaning you’re making a copy.

Objects and array are passed by reference, you’re passing a reference to the ‘container’ holding the variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What’s the spread operator?

A

In JavaScript, the spread operator is written as three dots (...). It’s a convenient way to take the elements from an iterable (like an array) and spread them into a new context, like another array or function arguments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are sets?

A

A collection of unique values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are template literals?

A

Template literals help make it simple to do string interpolation, or to include variables in a string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly