0% found this document useful (0 votes)
3 views

JS # 3 Conditional Statements

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

JS # 3 Conditional Statements

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment.

1. Write a JavaScript function to check if a number is even or odd.

2. How would you determine if a given year is a leap year using


JavaScript conditions?

3. Write code to check if a string is palindrome using JavaScript.

4. Explain the difference between && and || operators in


JavaScript with examples.

5. Write a JavaScript function to check if a number is positive,


negative, or zero.

6. How do you determine the largest of three numbers using


JavaScript conditions?

7. Write code to check if a given string contains only alphabets


using JavaScript.

8. Explain the purpose of the ternary operator (?:) in JavaScript


and provide an example.

9. How would you check if a given character is a vowel or


consonant using JavaScript?

10. Write a JavaScript function to check if a number is prime


or not.

11. Explain the purpose of the isNaN() function in JavaScript


and provide an example.

12. How can you determine if a given number is divisible by


both 5 and 7 using JavaScript?
13. Write code to check if a user input is a valid email address
using JavaScript.

14. Explain the concept of truthy and falsy values in


JavaScript.

15. How do you check if two given rectangles overlap using


JavaScript conditions?

You might also like