Objects Flashcards

1
Q

True or False: The global object itself can be accessed using the “this” operator in the global scope.

A

True

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

The global scope consists of ?

A

The global scope consists of the properties of the global object, including inherited properties, if any.

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

What global properties return a simple value? Meaning they have no properties or methods.

A

These global properties return a simple value: Infinity NaN undefined null literal

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

What are global functions?

A

Global functions are functions which are called globally rather than on an object and directly return their results to the caller. example: isNaN() parseInt()

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

What does the global function eval() do? And what is an example?

A

The eval() function evaluates JavaScript code represented as a string. Syntax: eval(string) Example: eval(new String(“2 + 2”)); // returns a String object containing “2 + 2” eval(“2 + 2”); // returns 4

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

What does the global function isFinite() do? And what is an example?

A

The global isFinite() function determines whether the passed value is a finite number. If needed, the parameter is first converted to a number. Syntax: isFinite(testValue) Example: isFinite(-Infinity); // false isFinite(0); // true

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

What does the global function isNaN() do? And what is an example?

A

The isNaN() function determines whether a value is NaN or not. Note: coercion inside the isNaN function has interesting rules; you may alternatively want to use Number.isNaN(), as defined in ECMAScript 6, or you can use typeof to determine if the value is Not-A-Number. Syntax: isNaN(testValue) Example: isNaN({}); // true isNaN(true); // false

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

What does the global function parseFloat() do? And what is an example?

A

The parseFloat() function parses a string argument and returns a floating point number. Syntax: parseFloat(string) Example: parseFloat(“3.14”); // 3.14 parseFloat(“314e-2”);// 3.14

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

What does the global function parseInt() do? And what is an example?

A

The parseInt() function parses a string argument and returns an integer of the specified radix (the base in mathematical numeral systems). Syntax: parseInt(string, radix); Example: parseInt(“ F”, 16); // 15 parseInt(“17”, 8); // 15

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

What does the global function decodeURI() do? And what is an example?

A

The decodeURI() function decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine. Syntax: decodeURI(encodedURI) Example: decodeURI(“https://developer.mozilla.org/ru/docs/JavaScript_%D1%88%D0%B5%D0%BB%D0%BB%D1%8B”); // “https://developer.mozilla.org/ru/docs/JavaScript_шеллы”

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

What does the global function decodeURIComponent() do? And what is an example?

A

The decodeURIComponent() function decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine. Syntax: decodeURIComponent(encodedURI) Example: decodeURIComponent(“JavaScript_%D1%88%D0%B5%D0%BB%D0%BB%D1%8B”); // “JavaScript_шеллы”

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

What does the global function encodeURI() do? And what is an example?

A

The encodeURI() function encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two “surrogate” characters). Syntax: encodeURI(URI) Example: // high-low pair ok console.log(encodeURI(‘\uD800\uDFFF’));

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

What does the global function encodeURIComponent() do? And what is an example?

A

The encodeURIComponent() function encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two “surrogate” characters). Syntax: encodeURIComponent(str);

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