2013年12月16日 星期一

【Javascript】String.format 格式化字串


以前常利用c#的String.fomat來達到我想要的格式輸出
最近要用js來將某些資料更新到前端畫面,就寫了一下,不過還並不完整

String.Format("{0}, Javascript! {1}.", "Hi", "This is test");  //Hi, Javascript! This is test.

String.Format("{greeting}, {name}! {something}.", 
{
    greeting:"Hi",
    name:"Javascript",
    something:"This is test"
});//Hi, Javascript! This is test.

2013年12月15日 星期日

【Javascript】 ECMA-404 標準 JSON

JSON Text
  • [U+005B left square bracket
  • {U+007B left curly bracket
  • ]U+005D right square bracket
  • }U+007D right curly bracket
  • :U+003A colon
  • ,U+002C comma
true  U+0074 U+0072 U+0075 U+0065 

false U+0066 U+0061 U+006c U+0073 U+0065






JSON值包含
  • object
  • array
  • number
  • string
  • true
  • false
  • null



\" represents the quotation mark character (U+0022). 
\\ represents the reverse solidus character (U+005C). 
\/ represents the solidus character (U+002F). 
\b represents the backspace character (U+0008). 
\f represents the form feed character (U+000C). 
\n represents the line feed character (U+000A). 
\r represents the carriage return character (U+000D). 
\t represents the character tabulation character (U+0009). 



原出處:Standard ECMA-404 The JSON Data Interchange Format

【Javascript】 重新認識javascript

在 Mozilla 上發現一篇整理的相當完整的 javascript 文章  重新認識javascript
對於javascrip 觀念還不是很熟的可以直接以這篇來當做學習的對像。