BASIC JS PROGRAMS-1
BASIC JS PROGRAMS-1
// Get the day of the week (0-6, where 0 is Sunday and 6 is Saturday)
var day = today.getDay();
// Determine if it's AM or PM
var prepand = (hour >= 12) ? " PM " : " AM ";
// Test the function with various years and log the results to the console
console.log(leapyear(2016)); // Expected output: true
console.log(leapyear(2000)); // Expected output: true
console.log(leapyear(1700)); // Expected output: false
console.log(leapyear(1800)); // Expected output: false
console.log(leapyear(100)); // Expected output: false
// Write a JavaScript program to find out if 1st January will be a Sunday between 2014 and
2050.
// Log a separator to visually distinguish the output
console.log('--------------------');
// Set the inner HTML of the element with the id "result" to the product of the two numbers
document.getElementById("result").innerHTML = num1 * num2;
}
// Set the inner HTML of the element with the id "result" to the quotient of the two numbers
document.getElementById("result").innerHTML = num1 / num2;
}