簡介JavaScript中Boolean.toSource()方法的使用
更新時間:2015年06月05日 10:49:59 投稿:goldensun
這篇文章主要介紹了簡介JavaScript中Boolean.toSource()方法的使用,是JS入門學習中的基礎知識,需要的朋友可以參考下
JavaScript Boolean.toSource()方法返回表示對象的源代碼的字符串。
注意:此方法不會在Internet Explorer中運行。
語法
boolean.toSource()
下面是參數(shù)的詳細信息:
- NA
返回值
返回表示對象的源代碼的字符串。
例子:
<html> <head> <title>JavaScript toSource() Method</title> </head> <body> <script type="text/javascript"> function book(title, publisher, price) { this.title = title; this.publisher = publisher; this.price = price; } var newBook = new book("Perl","Leo Inc",200); document.write(newBook.toSource()); </script> </body> </html>
這將產生以下結果:
({title:"Perl", publisher:"Leo Inc", price:200})
相關文章
Javascript基礎教程之數(shù)據(jù)類型 (字符串 String)
javascript一共有9種數(shù)據(jù)類型,分別是字符串 String、數(shù)值型 Number、布爾型 Boolean、未定義 Undefine、空值 Null、對象 Object、引用Refernce、列表型 List、完成型 Completion,我們今天首先來看看(字符串 String)2015-01-01淺析offsetLeft,Left,clientLeft之間的區(qū)別
這篇文章主要是對offsetLeft,Left,clientLeft之間的區(qū)別進行了詳細的分析介紹,需要的朋友可以過來參考下想,希望對大家有所幫助2013-11-11簡單介紹JavaScript的變量和數(shù)據(jù)類型
這篇文章主要介紹了簡單介紹JavaScript的變量和數(shù)據(jù)類型,是JS入門中的基礎知識,需要的朋友可以參考下2015-06-06