.string function in js code example
Example 1: is string javascript
function isString(value) {
return typeof value === 'string' || value instanceof String;
}
isString(''); // true
isString(1); // false
isString({}); // false
isString([]); // false
isString(new String('teste')) // true
Example 2: javascript function from string
var addition = Function("a", "b", "return a + b;");
alert(addition(5, 3)); // shows '8'