JavaScript Operators

Photo by Pankaj Patel on Unsplash
console.log(true && false); // -> && and operator
//output -> false
console.log(true && true);
//output -> true
console.log(false || true); // -> || or operator
//output -> true
console.log(false || false);
//output -> false
console.log(!true) // -> ! not operator
//output -> false

Unary Operators

https://www.digitalocean.com/community/tutorials/javascript-unary-operators-simple-and-useful

Ternary operator

//If statement
if(true){
console.log("hola");
}else{
console.log("mundo");
}
//output -> hola
//Ternary operator
true ? console.log("hola") : console.log("mundo")
//output -> hole
const arrayOne = [1,2,3];
const arrayTwo = [4,5,6];
const fullArray = [...arrayOne,...arrayTwo];
console.log(fullArray);
//output -> [1,2,3,4,5,6]

Passionate reading || Coding Addicted || FullStack Web Developer from Costa Rica

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store