Flashcards in JS Operators & Misc Grammar Deck (38):

1

##
delete Operator

delete person.age;

### deletes a property from an object

2

##
in Operator

"firstName" in person

4 in array

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

3

##
instanceof Operator

cars instanceof Array

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

4

##
break ?labelname;

use with label:

Loop2:

for (j = 10; j < 15; j++) {

if (j === 12) {

break Loop2;

}

}

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

5

## continue ?labelname

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

6

## debugger

### enter debugging mode

7

## do...while

### 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

8

##
for (statement 1; statement 2; statement 3) {

code block to be executed

}

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

9

##
for (var in object) {

code block to be executed

}

for (x in person) {

text += person[x];

}

###
loops through the properties of an object.

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

10

## return value;

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

11

##
switch(expression) {

case n:

code block

break;

case n:

code block

break;

default:

default code block

}

### executes a block of code depending on different cases

12

##
while (condition) {

code block to be executed

}

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

13

## Math.E

### Returns Euler's number (approx. 2.718)

14

## Math.LN2

### Returns the natural logarithm of 2 (approx. 0.693)

15

## Math.LN10

### Returns the natural logarithm of 10 (approx. 2.302)

16

## Math.LOG2E

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

17

## Math.LOG10E

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

18

## Math.PI

### Returns PI (approx. 3.14)

19

## Math.SQRT1_2

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

20

## Math.SQRT2

### Returns the square root of 2 (approx. 1.414)

21

## Math.abs(x)

### Returns the absolute value of x

22

## Math.acos(x)

### Returns the arccosine of x, in radians

23

## Math.asin(x)

### Returns the arcsine of x, in radians

24

## Math.atan(x)

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

25

## Math.atan2(y,x)

### Returns the arctangent of the quotient of its arguments

26

## Math.ceil(x)

### Returns x, rounded upwards to the nearest integer

27

## Math.cos(x)

### Returns the cosine of x (x is in radians)

28

## Math.exp(x)

### Returns the value of E^x

29

## Math.floor(x)

### Returns x, rounded downwards to the nearest integer

30

## Math.log(x)

### Returns the natural logarithm (base E) of x

31

## Math.max(x,y,....)

### Returns the number with the highest value

32

## Math.min(x,y,...)

### Returns the number with the lowest value

33

## Math.pow(x,y)

### Returns the value of x to the power of y

34

## Math.random()

### Returns a random number between 0 and 1

35

## Math.round(x)

### Rounds x to the nearest integer

36

## Math.sin(x)

### Returns the sine of x (x is in radians)

37

## Math.sqrt(x)

### Returns the square root of x

38