JS syntax core (b)

(A) operator concepts and definitions

1. The operator definition and classification:

2. The operator Category:

3. The operator binding

(B) operator

1. The addition operator:

2. subtraction operator: addition and subtraction is not very different, the fourth point NOTE: string subtraction result will be Number.

3. The multiplication operator:

4. division operator: string will do the divisions into Number

The modulo operator

6. The unary operators:

7. assignment operator:

8. increment / decrement operators had

9. The logical operators:

Logic and

Logical or

Logical NOT:

10. Relational operators:

Comma expression:

Ternary operator:

Operator priority:

operation:

<!DOCTYPE html>

<html>

<head>

<title>

User keyboard input three integers, and outputs the maximum is found

</title>

</head>

<script>

// three integers user input from the keyboard, and outputs the maximum is found

1 // Define variable

was num1, num2, num3, max;

// 2 receives user input

num1 = parseFloat (prompt ( 'Enter the first integer!'));

num2 = + (prompt ( 'Enter second integer!'));

num3 = parseInt (prompt ( 'Enter third integer!'));

// 3. Comparative

max = num1>num2?num1:num2;

max = max>num3?max:num3;

// output 4:

console.log(max);

</script>

<body>

</body>

</ Ht command>

 

Guess you like

Origin blog.csdn.net/weixin_40876986/article/details/91351819