|
| 1 | +let name = "waseem akram"; |
| 2 | +let age = 20; |
| 3 | +let isMarried = false; |
| 4 | +let university; |
| 5 | +let bankBalance = null; //give us null which is datatype |
| 6 | +bankBalance = ""; //it will give us empty in console |
| 7 | +let answer = 42; |
| 8 | +answer = "Thanks for submeting"; // it will print ..because js is dynamically typed language so it datatype |
| 9 | +//will automaticly convert during execution.. |
| 10 | +/* In expressions involving numeric and string values with the + operator, JavaScript converts numeric values to strings.*/ |
| 11 | +let x, y, z; |
| 12 | +x = "the answer is " + 42; // this will convert into string |
| 13 | +y = 42 + " is my answer"; //it will also combine with string and become string |
| 14 | +z = "37" + 7; // string + number=> string so the output will be 377 |
| 15 | +let u, v, s; |
| 16 | +u = 7 - "37"; //string -number=number =>37-7=30 or number-string=number same.. |
| 17 | +v = "37" * 7; //string* number =number => 37*7=259 |
| 18 | +s = "37" / 7; //string /number=number =>37/7=5.28 |
| 19 | +console.table([u, v, s]); |
| 20 | + |
| 21 | +// console.log([typeof name, typeof age, typeof isMarried, typeof university]); |
| 22 | + |
| 23 | +//premitive data types 7 |
| 24 | +//Number => range i think 2 the power of 64 |
| 25 | +//bigInt => use for big values which will used in transactions,account balance and crypto.. |
| 26 | +//string => in the form of "" |
| 27 | +// boolean which is simply in true or false |
| 28 | +// undefined variable which is not defined just like above university..it is decalred but not defined. |
| 29 | +//symbol => unique,immutable which cannot be chnaged. |
| 30 | +// null which is single value mean it's empty .. null is object .you can check it through type of . |
| 31 | + |
| 32 | +//Objects |
| 33 | +// const portfolio = { |
| 34 | +// name: "waseem akram", |
| 35 | +// skill: "javascript developer", |
| 36 | +// degree: "BSIT", |
| 37 | +// }; |
| 38 | + |
| 39 | +// console.log(portfolio.name); //waseem akram |
| 40 | +// console.log(portfolio.skill); //javascript developer |
| 41 | +// console.log(bankBalance); |
| 42 | +// console.log(answer); |
| 43 | +// console.table([x, y, z]); |
0 commit comments