কম্পিউটার টিউটোরিয়াল

জাভাস্ক্রিপ্টে ভেরিয়েবলের আগে প্লাস (+) চিহ্নের অর্থ

ভেরিয়েবলের আগে প্লাস চিহ্ন (+) দিলে সেটি নাম্বারে রূপান্তরিত হয় (Unary Plus Operator)। স্ট্রিংকে নাম্বারে কনভার্ট করতে এটি ব্যবহৃত হয়।

উদাহরণ

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
  1. জাভাস্ক্রিপ্ট DOM কী?

  2. জাভাস্ক্রিপ্ট টাইপ কোэрসন কী?

  3. জাভাস্ক্রিপ্ট Error ক্লাস এক্সটেন্ড করে কাস্টম এরর বানানো

  4. সঠায়িক ডেটা মাইনিং-এর কৌশলগুলি কী কী?