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.