JavaScript Answers (1)
JavaScript Answers (1)
2. Write a script that reads an integer and displays whether it is a prime number or not.
if (isPrime) { alert(num + ' is a prime number.'); } else { alert(num + ' is not a prime number.'); }
Example:
if (i == 3) continue;
console.log(i);
} // Output: 1,2,4,5
- Lightweight
- Object-oriented
- Platform-independent
- Dynamic typing
Example:
- Number
- String
- Boolean
- Object
- Undefined
- Null
sum += digit ** 3;
10. State the use of dot syntax in JavaScript with suitable example.
Example:
console.log(student.name);
13. Write syntax of and explain prompt method in JavaScript with example.
Example:
14. Write a JavaScript that displays all properties of window object. Explain the code.
console.log(prop);
15. Write a JavaScript function that checks whether a passed string is palindrome or not.
function isPalindrome(str) {
Client Side Scripting Languages - JavaScript Answers
16. Describe all the tokens of the following statements: document.bgColor document.write()
document: webpage