1if (typeof myVar === 'integer'){
2 //I am indeed an integer
3}
4
5if (typeof myVar === 'boolean'){
6 //I am indeed a boolean
7}
1function isString(x) {
2 return Object.prototype.toString.call(x) === "[object String]"
3}
4
1let eventValue = event.target.value;
2
3 if (/^\d+$/.test(eventValue)) {
4 eventValue = parseInt(eventValue, 10);
5 }
6
7//If value is a string, it converts to integer.
8
9//Otherwise it remains integer.