javascript - When is it safe to use .toString()? -


Do not return the string () to be able to call the value.toString () value? When do you know that you can call value.toString ()?

  & lt; Script & gt; Var newList = function (val, lst) {return} {value: val, tail: lst, toString: function () {var results = this.value.toString (); If (this.tail! = Null) results + = ";" + This.tail.toString (); Return result; }, Append: function (val) {if (this.tail == empty) this.tail = newList (val, null); and this. Tail.append (val); }}; } Var list = newList ("abc", tap); // a string list.append (3.14); // a floating-point number list.append ([1, 2, 3]); // An array document. Written (list.toString ()); & Lt; / Script & gt;  


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -