作者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