# TAILIEUCHUNG - JQuery: Novice to Ninja- P28

## JQuery: Novice to Ninja- P28:No matter what kind of ninja you are—a cooking ninja, a corporate lawyer ninja, or an actual ninja ninja—virtuosity lies in first mastering the basic tools of the trade. Once conquered, it’s then up to the full-fledged ninja to apply that knowledge in creative and inventive ways. | 382 jQuery Novice to Ninja When we add a string and a number using the operator JavaScript assumes we re trying to concatenate the two so it creates a new string. It would appear to change the number s variable type to string. When we use the multiplication operator though JavaScript assumes that we want to treat the two variables as numbers. The variable itself remains the same throughout it s just treated differently. We can always explicitly tell JavaScript how we intend to treat a variable but if we don t we need to understand just what JavaScript is doing for us. Here s another example alert a c alerts 22 alert a parselnt c alerts 4 Equality Operators The equal sign and its related operators can also provide a trap for young players. And where it was once just a little odd it became even more so in JavaScript . The first trick is that the equal sign has a different meaning than what you remember from your school mathematics classes var a 2 var b 2 A single equal sign is an assignment operator and is used to assign values to variables. We all knew what it did but now we know what it s called var c a b Two signs together is known as the equality operator and establishes a Boolean value. In our example the variable c will have a value of true as JavaScript compares the values before and after the equality operator and considers them to be equal. Using the equality operator JavaScript pays no heed to the variable s type and attempts to coerce the values to assess them. Switch out the first equal sign for an exclamation mark and you have yourself an inequality operator . This operator will return false if the variables are equal or true if they aren t Appendix B JavaScript Tidbits 383 var d a b The variable d will now have a value of false since a and b are equal. It may be a little complex but at least it s consistent. In JavaScript the situation became less simple still with the introduction of one further operator the strict equality operator shown as . .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
9    4    0    11-08-2020
13    9    0    11-08-2020
1    6    0    11-08-2020
20    2    0    11-08-2020
3    6    0    11-08-2020
1    5    0    11-08-2020
22    13    0    11-08-2020
20    8    0    11-08-2020
2    5    0    11-08-2020
11    4    0    11-08-2020
400    8    0    11-08-2020
190    1    0    11-08-2020
7    5    0    11-08-2020
205    3    0    11-08-2020
128    4    0    11-08-2020
6    3    0    11-08-2020
86    4    0    11-08-2020
14    7    0    11-08-2020
5    3    0    11-08-2020
3    6    0    11-08-2020
TÀI LIỆU XEM NHIỀU
24    2404    7
8    2048    6
29    1904    6
165    1743    1
2    1694    0
64    1648    3
35    1622    2
15    1586    0
1    1584    3
14    1532    0
TÀI LIỆU HOT
580    1274    122
171    647    84
116    53    56
21    116    49
51    213    47
8    89    39
16    106    37
17    79    34
81    24    32
121    60    31
TÀI LIỆU LIÊN QUAN
28    11    0
32    11    0
32    9    0
32    11    0
32    8    0
32    10    0
32    9    0
32    9    0
32    6    0
24    10    0
7    14    0
4    12    0
71    12    0
1    14    0
44    9    0
54    13    0
54    9    0
54    9    0
44    10    0
54    10    0
54    12    0
54    9    0
54    8    0
52    7    0
16    16    0
20    9    0
21    15    0
22    15    0
21    9    0
22    8    0
23    11    0