JavaScript Validation - Exercises, Practice, Solution
JavaScript validation [10 exercises with solution]
[An editor is available at the bottom of the page to write and execute the scripts. Go to the editor]
1. Write a JavaScript function to validate whether a given value type is boolean or not.
2. Write a JavaScript function to validate whether a given value type is an error or not.
3. Write a JavaScript function to validate whether a given value type is NaN or not.
4. Write a JavaScript function to validate whether a given value type is null or not.
5. Write a JavaScript function to validate whether a given value is a number or not.
6. Write a JavaScript function to validate whether a given value is an object or not.
7. Write a JavaScript function to validate whether a given value type is a pure JSON object or not.
8. Write a JavaScript function to validate whether a given value is RegExp or not.
9. Write a JavaScript function to validate whether a given value type is char or not.
10. Write a JavaScript function to check whether the given values are the same or not.
More to Come !
* To run the code mouse over on Result panel and click on 'RERUN' button.*
Live Demo:
See the Pen javascript-common-editor by w3resource (@w3resource) on CodePen.
Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.
JavaScript: Tips of the Day
Eequality test
console.log(Number(2) === Number(2)); console.log(Boolean(false) === Boolean(false)); console.log(Symbol('foo') === Symbol('foo'));
Every Symbol is entirely unique. The purpose of the argument passed to the Symbol is to give the Symbol a description. The value of the Symbol is not dependent on the passed argument. As we test equality, we are creating two entirely new symbols: the first Symbol('foo'), and the second Symbol('foo'). These two values are unique and not equal to each other, Symbol('foo') === Symbol('foo') returns false.
Ref: https://bit.ly/323Y0P6
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook