জাভাস্ক্রিপ্ট : লেটারাল এবং ডাটা টাইপ
লেটারাল: লেটারাল হচ্ছে ডাটা বা মান যা আমরা ভেরিয়েবল এ তা নির্ধারণ করতে পারি
যেমন:
1. Number Literal
var x=10
var x=63.34
এখানে 10 and 63.34 হচ্ছে Number লেটারাল,
2. Scientific Notations
var x=3.56e+2;
NB: The letter e is followed by a plus or minus sign and from one to three integers. The integers following the e are the exponent, and the rest of the number (preceding the e notation) is multiplied by 10 to the power of the exponent.
3. String Literal
var str="Hello"
var st2='World'
এখানে "Hello" and 'World' হচ্ছে String লেটারাল,
4. Boolean Literal
var b=true;
var c=false;
এখানে true and false হচ্ছে Boolean লেটারাল,
5. Hexadecimal Literal
var h=0xAF2,
এখানে 0xAF2 হচ্ছে Hexadecimal লেটারাল,
6. Regular Expression Literal
var r=/[0-9]{5,10}/,
এখানে /[0-9]{5,10}/ হচ্ছে Regular Expression লেটারাল,
7. Null Literal
var n=null ,
এখানে null হচ্ছে Null লেটারাল,
8. Undefined Literal
var n=undefined ,
এখানে undefined হচ্ছে Undefined লেটারাল,
9. Function Literal
var f=function(){},
এখানে function(){} হচ্ছে Function লেটারাল,
10. Array Literal
var arr=['red','green','blue','yellow']
এখানে ['red','green','blue','yellow'] হচ্ছে Array লেটারাল,
11. Object Literal
var book_obj={'title':'Learning PHP','ISBN':'4305487'}
এখানে {'title':'Learning PHP','ISBN':'4305487'} হচ্ছে Object লেটারাল
or
var book_obj=new Object();
book_obj.title='Learning PHP';
book_obj.ISBN='4305487';
12. NaN Literal
let x=NaN;
এখানে NaN হচ্ছে NaN লেটারাল,
Comments 0