Reputation: 74
Can we determine the data type (string, integer, boolean, etc.) of variables using react native?
For example:
class ex {
years: integer;
name: string;
remember: boolean;
}
Can I decide whether the data from the form is a string or an integer?
Upvotes: 4
Views: 19580
Reputation: 2962
yes you can find type of a variable using typeof(your variable name)
Example
var name="name here";
console.log("type of variable is:"+typeof(name));
output
type of variable is: string
Upvotes: 5