Skip to main content

Boolean Data Type

 // CLASS TOPICS : BOOLEAN DATA TYPE  
 // true or false  
   
 // a = 10  
 // b = 20  
 // console.log(a != b);  
 // not equal to -> same in javscript is !=  
 // equal to => ==  
 // we can check logic it will be either true or false  
   
   
 // CHAINING LOGIN  
 // console.log(1 > 0 < 5 < 6);  
 // chaining expressions to get logical value either true or false  
   
   
 // CHECK IF BOTH ARE TRUE  
 // isBreadAvailable = true  
 // isEggAvailable = false  
   
 // console.log(isBreadAvailable && isEggAvailable)  
 // so here we are checking if both value are true using &&  
   
   
   
 // check if any one of them is true  
 // console.log(1 > 5 || 2 > 5)  
 // using || means you are checking if any of the given condition is true or not  
   
   
 // mixup of and ,or  
 // console.log( (1 < 5 && 2 > 5) || 1 > 0)  
   

Comments

Popular posts from this blog

Basics of Object Data Type

// CLASS TOPICS : Object DATA TYPE // myValue = {name:"shagun", age:23,email:"info@codesikho.com"} // console.log(myValue); // object is written using {} symbol // we will write our key:value pair between {} separated by , // value maybe a string , array or a object or maybe a number // HOW TO ACCESS VALUES? // myValue = {name:"shagun", age:23,email:"info@codesikho.com"} // myKeyVal= myValue["email"] // myKeyVal = myValue.age // console.log(myKeyVal); // so we can access either entering key name between [] in a string format // or we can access using . and then key name // we cannot write value with same key otherwise it will get override // myValue = {name:"shagun",name:"abc"} // console.log(myValue.name);

Basics of String Data Type

// CLASS TOPICS : STRING DATA TYPE // "H" , "E" , "L", "O" // string is a combination of few characters // we can re-assign variables as done below // myValue = 'hello' // console.log(myValue, 'called') // myValue = 1 // console.log(myValue, 'called 2') // myValue = [1,2,3] // console.log(myValue,'called 3') // we can access charac from string same as we can do with array's // myValue = "hello" // myCharac = myValue[2] // console.log(myCharac); // we can create space b/w charac too // myValue = "hello " + "world" // console.log(myValue) // behind the scenes space is also being stored like this: ["h","e","l","l","o",""] // we can use \n to print data in next line // myValue = "hello my name is: \n shagun" // console.log(myValue); // we can also use \t to create space between words in the same line