JS Operators & Misc Grammar Flashcards

1
Q

delete Operator

delete person.age;

A

deletes a property from an object

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

in Operator

“firstName” in person
4 in array

A

returns true if the specified property is in the specified object, otherwise false

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

instanceof Operator

cars instanceof Array

A

returns true if the specified object is an instance of the specified object

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

break ?labelname;

use with label:
Loop2: 
    for (j = 10; j < 15; j++) {
        if (j === 12) {
            break Loop2;
        }
    }
A

exits a switch statement or a loop (for, for … in, while, do … while)

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

continue ?labelname

A

breaks one iteration (in the loop) if a specified condition occurs, and continues with the next iteration in the loop

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

debugger

A

enter debugging mode

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

do…while

A

creates a loop that executes a block of code once, before checking if the condition is true, then it will repeat the loop as long as the condition is true

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

for (statement 1; statement 2; statement 3) {
code block to be executed
}

A

creates a loop that is executed as long as a condition is true

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

for (var in object) {
code block to be executed
}

for (x in person) {
text += person[x];
}

A

loops through the properties of an object.

The block of code inside the loop will be executed once for each property.

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

return value;

A

stops the execution of a function and returns a value from that function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
switch(expression) {
    case n:
        code block
        break;
    case n:
        code block
        break;
    default:
        default code block
}
A

executes a block of code depending on different cases

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

while (condition) {
code block to be executed
}

A

creates a loop that is executed while a specified condition is true

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

Math.E

A

Returns Euler’s number (approx. 2.718)

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

Math.LN2

A

Returns the natural logarithm of 2 (approx. 0.693)

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

Math.LN10

A

Returns the natural logarithm of 10 (approx. 2.302)

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

Math.LOG2E

A

Returns the base-2 logarithm of E (approx. 1.442)

17
Q

Math.LOG10E

A

Returns the base-10 logarithm of E (approx. 0.434)

18
Q

Math.PI

A

Returns PI (approx. 3.14)

19
Q

Math.SQRT1_2

A

Returns the square root of 1/2 (approx. 0.707)

20
Q

Math.SQRT2

A

Returns the square root of 2 (approx. 1.414)

21
Q

Math.abs(x)

A

Returns the absolute value of x

22
Q

Math.acos(x)

A

Returns the arccosine of x, in radians

23
Q

Math.asin(x)

A

Returns the arcsine of x, in radians

24
Q

Math.atan(x)

A

Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians

25
Q

Math.atan2(y,x)

A

Returns the arctangent of the quotient of its arguments

26
Q

Math.ceil(x)

A

Returns x, rounded upwards to the nearest integer

27
Q

Math.cos(x)

A

Returns the cosine of x (x is in radians)

28
Q

Math.exp(x)

A

Returns the value of E^x

29
Q

Math.floor(x)

A

Returns x, rounded downwards to the nearest integer

30
Q

Math.log(x)

A

Returns the natural logarithm (base E) of x

31
Q

Math.max(x,y,….)

A

Returns the number with the highest value

32
Q

Math.min(x,y,…)

A

Returns the number with the lowest value

33
Q

Math.pow(x,y)

A

Returns the value of x to the power of y

34
Q

Math.random()

A

Returns a random number between 0 and 1

35
Q

Math.round(x)

A

Rounds x to the nearest integer

36
Q

Math.sin(x)

A

Returns the sine of x (x is in radians)

37
Q

Math.sqrt(x)

A

Returns the square root of x

38
Q

Math.tan(x)

A

Returns the tangent of an angle