I get a return value from a function which is always string. i used typeof(obj) which turns out to be string always.
Date.functionName=Date.prototype.functionName=function(dataObj) {
//The dataObj is always string.
// How can i differentiate between the values...
};
I have three things coming as strings..
- Date
- String…
- Integer values…
All the three are of type string.
- How can i differentiate these three values.
- Is it correct to use Date.mycustomfunction… or should i use some
other class…
You can use isNaN to check if it’s an integer or not. And there’s some interesting ideas here for isDate type of functionality. Also some answers here may help: How can I determine whether a given string represents a date?