How to use valueof method in JavaScript
Editor to share with you how to use the valueof method in JavaScript, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The valueof method in JavaScript is used to return the original value of the Boolean object, its syntax is "booleanObject.valueOf ()", and the return value is the original Boolean value of booleanObject.
This article operating environment: windows7 system, javascript1.8.5 version, Dell G3 computer.
JavaScript valueOf () method
Its definition and usage
The valueOf () method returns the original value of the Boolean object.
Grammar
BooleanObject.valueOf ()
Return value: the original Boolean value of booleanObject.
Throw: if the object calling the method is not Boolean, an exception TypeError is thrown.
Examples of use:
In this case, we will create a Boolean object and use valueOf () to get the original value of this object:
Var boo = new Boolean (false) [xss_clean] (boo.valueOf ())
Output:
False above is all the content of this article entitled "how to use the valueof method in JavaScript". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!