Javascript weird things (1)comment , data type for a number
1. When you have to write a comment in your javascript code, it's safer to write a comment with a single line comment than with a multi line comment(comment block).
// Single line comment
/* Multi line
comment
*/
The reason former is safer is that */ <- It appers in regular expressions too.
So sometimes it might throw an syntax error.(when mixed regular expressions & multi line comment).
2. Javascript has a only one data type for a number. (It is same as 'double' in Java).
So there is no difference between 1 and 1.0
1 == 1.0
-> true!
You can check it on the browser console.
Reference Book : Javascript the good parts(Douglas crockford)
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기