연산자(JavaScript)
| |
// Two strings with the same value. var string1 = "Hello"; var string2 = "Hello"; // Two String objects with the same value. var StringObject1 = new String(string1); var StringObject2 = new String(string2); if (string1 == string2) document.write("string1 is equal to string2 <br/>"); if (StringObject1 != StringObject2) document.write("StringObject1 is not equal to StringObject2 <br/>"); // To compare the values of String objects, use the toString() or valueOf() methods. if (StringObject1.valueOf() == StringObject2.valueOf()) document.write("The value of StringObject1 is equal to the value of StringObject2"); //Output: // string1 is equal to string2 // StringObject1 is not equal to StringObject2 // The value of StringObject1 is equal to the value of StringObject2
from MSDN : https://msdn.microsoft.com/ko-kr/library/6hsc0eak(v=vs.94).aspx
연산자 우선 순위(JavaScript)
^ | |
| | |
, |
var result = 78 * 96 + 3; document.write(result); document.write("<br/>"); result = 78 * (9 + 3); document.write(result); // Output: // 7491 // 936
var num = 10; if(5 == num / 2 && (2 + 2 * num).toString() === "22") { document.write(true); } // Output: // true
from MSDN : https://msdn.microsoft.com/ko-kr/library/z3ks45k7(v=vs.94).aspx
///847.
'지속가능티끌 > JavaScript' 카테고리의 다른 글
JavaScript. 개체 만들기. (0) | 2016.07.27 |
---|---|
JavaScript. 함수 (Functions) (0) | 2016.07.27 |
JavaScript. 변수 (Variable). 전역,지역 (0) | 2016.07.27 |
JavaScript. 프로그램 흐름제어. if,while, for, break, continue. (0) | 2016.07.27 |
JavaScript. 코드 작성 룰. (0) | 2016.07.27 |
댓글