作者Funitory (不如怜取眼前人)
看板Web_Design
标题[问题] js的字串和数字要分开吗?
时间Tue Oct 8 01:55:16 2013
如题,想请教如果我要写
My birthday is March 1 2012.
那是不是要把 2012和字串分开呢?
例如写成 "My birthday is March" + 1 2012?
会产生这样的疑问是在於看到下面这个:
Variables and Expressions
Variables are used to hold values or expressions. An expression is any valid
unit of code that resolves to a value. For example,
"JavaScript is #" + 1 is
an expression that resolves to
"JavaScript is #1". An expression can also be
a value, function, or object, which we will cover later in the course. When
dealing with simple value expressions like 42, we usually just call them
"value".
来源:
http://www.learnstreet.com/
这里的resolve代表什麽意思呢?解答 or 分辨 or 使变成..?
它的文字为什麽和字串要分开呢
请多指教...谢谢大家~~
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 36.224.196.145
1F:→ danny8376:... 如果是fixed的string请写死就好... 别徒增转换 10/08 01:59
2F:→ danny8376:这里是说JS对这种非string的concat会自动去stringify 10/08 02:00
3F:→ lyforever:你应该写成 "My birthday is"+ date object吧 .... 10/08 14:31