and if in for loop javascript code example
Example 1: javascript if and statement
let a = 1;
let b = 2;
if(a == 1 && b ==2){
// Code here
}
Example 2: javascript if
const number = (Math.random() - 2.5) * 5;
if (number < 0) {
console.log('Number is negative');
}
if (number = 0) {
console.log('Number is zero');
}
if (number > 0) {
console.log('Number is positive');
}