Forum

Yampiz Forum

Sharing let knowledge Spreaded, Reading let spirits growth, Creative let culture extended, Let us
  • 禁止廣告文
  • 知識傳播
  • 閱讀
  • 心靈成長
  • 創作
  • 文化傳承
Forum Dictionary / Programming / 網頁/網站程式 / JavaScript /

Javascript 的 eval() 語法

New Subject
Random
Previous
Next
|
Javascript 的 eval() 語法

eval() 是一個相當有趣、強大、不容易理解的函式,但功用實在太強,撰寫 Javascript 時經常會使用到。

eval 是 evaluates 的簡寫,是用來將「一句話」執出來。例如:

var n=3;
var b=5,c=6;
eval('a'+n+'=b*c');

上例,在 eval() 中的字串,展開變成

a3=b*c

沒錯,結果就是 a3=b*c,也就是變數 a3 的結果為 30。

由上例可知,eval() 是把一串字串,當作指令來執行,並得出結果。

  • Keywords : 變數, 簡寫, 相當, 由上例可知, 用來, 沒錯, 撰寫, 把一串字串, 得出, 強大, 展開變成, 字串, 太強, 執出來, 函式, 例如, 但功用實, 不容易理解, 上例, 一句話
0 0
2009-04-22T15:34:48+0000


  • Now, you can post comments by Facebook Account when your Yampiz account was logout or unvariable. whatever, we suggest to post comment by Yampiz Account to get more bounds to join new events of Heyxu
Comment
 
Verify

Facebook Page

QR-Code and APP Launcher

User Guide
This Webpage

In those service tabs, "Scan QRCode, in mobile device" or "Click the button, in this device" to open webpage or APP-related operations.
QRCode
  • Auto Platform
    For better browsing experience, it will auto detects your device to display webpage.
  • Bug Report
    Tell us about the idea, problem and errors you found.
  • Comodo Secure
    The sensitive data transmission adopts by SSL-2048 authenticated encryption.
  • Copyright
    © 2009 YamPiz Digital Inc. & Jaby Group. All rights reserved.
  • Revised Version
    V2.2.061
    03 Aug 2023 (GMT+8)