उदाहरण
प्लस (+) साइन वेरिएबल को नंबर में कन्वर्ट करता है।
var firstValue = "1000";
console.log("The data type of firstValue =" + typeof firstValue);
var secondValue = 1000;
console.log("The data type of secondValue =" + typeof secondValue);
console.log("The data type of firstValue when + sign is used =" + typeof +firstValue);
var output = +firstValue + secondValue;
console.log("Addition is=" + output);
प्रोग्राम चलाने के लिए:
node fileName.js
आउटपुट
PS C:\Users\Amit\JavaScript-code> node demo149.js The data type of firstValue =string The data type of secondValue =number The data type of firstValue when + sign is used =number Addition is=2000