Data Types in JavaScript Flashcards

1
Q

This 64 bit format is used to store numbers in JS

A

IEEE-754

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

use this method to convert a number to string

A

.toString(base)

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

this is the value numbers pick if they overflow storage

A

Infinity

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

4 most used rounding functions

A

Math.round
Math.ceil
Math.floor
Math.trunc

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

does NaN equal itself?

A

No

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

character encoding of strings in JS

A

UTF-16

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

Strings are immutable in JS. True/False

A

True

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

In JS lowercase alphabets are greater than Uppercase alphabets

A

True

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

Names of codePoint methods

A

codePointAt() —> gives unicode value

fromCodePoint() —> gets unicode character from integer value

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

localeCompare is used to compare two ____?

A

strings

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

What does the at() function do in an array

A

it fetches the element at position i;

if i is negative, it counts backwards.

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

Arrays extend objects in JavaScript. True / False ?

A

True

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

It is possible to add non-numeric key in an array. True / False ?

A

True, this is an inconvenience as programmer needs to be alert.

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

The length property in array is the number of elements in the array. True or False ??

A

False, it is the largest numeric index + 1.

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

This is the fastest and easiest way to clear an array in JS.

A

arr.length = 0;

length once reduced, truncates the array, and cannot be reassigned to its initial value.

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

The splice method returns this ____

A

the list of removed elements.

17
Q

Symbol.iterator is used for ____

A

making an object iterable in the for…of loop

18
Q

the 7 main methods of map are

A

new Map() - create map;

map. set(key, value) - insert key, value pair in map
map. get(key) - get the value of key
map. has(key) - true if key exists; false otherwise
map. delete(key) - remove value by key
map. clear() - remove all elements of map
map. size() - returns count of elements in map

19
Q

What is SameValueZero

A

It is the algorithm maps use to compare keys; it is like strict equality, but only NaN is equal to NaN.

20
Q

Map preserves the order of insertion. True / False ?

A

True. Objects are the ones that do not store values in inserted order.

21
Q

The six methods of set are

A

new Set(iterable);

set. add(value);
set. delete(value);
set. has(value);
set. clear();
set. size();

22
Q

Reflect.ownKeys(obj) returns ___

A

all keys; even symbolic ones.

23
Q

Object.getOwnPropertySymbols(obj) returns ___

A

only symbolic keys

24
Q

strings are iterables is JavaScript. True / False ?

25
for(let [key, value] of Object.entries(obj)) {...} | Which JS feature allows key, and value to be broken up as such?
destructuring
26
use destructuring to get all default values in an object
functionCall( { } );
27
JSON.stringify works on primitives. True / False ?
True
28
JSON.stringify works on arrays. True / False ?
True
29
Strings in JSON object use single ticks, and backticks. True or False ?
False
30
what is the first key, value pair the replacer function puts in JSON format
:[object Object]
31
JSON.stringify gives an error in this case of object reference
circular reference
32
In JS we can call any function with any number of arguments no matter how it is defined. True or False ?
True; but extra arguments will be ignored.
33
arrow functions do not have "this" and they do not have their own ____ object either
argument; which stores the argument list.
34
What is hoisting?
The phenomenon in which variables declared with "var" are automatically moved to top of function declaration irrespective of their declaration in the function.
35
browser:window :: Node.js:____
global; | it is the name of the global object
36
name of a generalized global object that was recently added to the language ____
globalThis
37
alert/confirm/prompt makes timer stop. True or False ?
False.
38
multiple event handlers are executed in this order ___
in the order that they are written.