TAILIEUCHUNG - Học JavaScript qua ví dụ part 12

Các loại nhà khai thác Toán tử số học Số học điều hành có giá trị số (hoặc các chữ hoặc các biến) như-oper của họ ands và trả lại một giá trị số. Các toán tử số học tiêu chuẩn được cộng (+), trừ (-), nhân (*), và phân chia (/). | About JavaScript Operators and Expressions 85 In Table the operators on the same line are of equal precedence. The rows are in order of highest to lowest precedence. Table Precedence and Associativity Operator Description Associativity 0 Parentheses Left to right Auto increment decrement Right to left Logical NOT Right to left Multiply divide modulus Left to right - Add subtract Left to right Concatenation Left to right Less than less than or equal to Left to right Greater than greater than or equal to Left to right Equal to not equal to Left to right Identical to same type not identical to Left to right Bitwise AND Left to right 1 Bitwise OR A Bitwise XOR Bitwise NOT Bitwise left shift Bitwise right shift Bitwise zero-filled right shift Logical AND Left to right II Logical OR Left to right Ternary conditional Right to left - 1 Assignment Right to left comma From the Library of 86 Chapter 5 Operators EXAMPLE html head title First JavaScript Sample title script type text javascript 1 var result 5 4 12 4 script head body bgcolor yellow text blue big script type text javascript 2 result result br script big body html EXPLANATION 1 The order of associativity is from left to right. Multiplication and division are of a higher precedence than addition and subtraction and addition and subtraction are of higher precedence than assignment. To illustrate this we ll use parentheses to group the operands as they are grouped by JavaScript. In fact if you want to force precedence use the parentheses around the expression to group the operands in the way you want them evaluated. The following two examples produce the same result var result 5 4 12 4 could be written result 5 4 12 4 2 The expression is evaluated and the result is assigned to variable result. The value of result is displayed on the browser see Figure . Figure Output from Example Precedence and associativity. From the Library of About JavaScript

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.