is letter javascript code example

Example 1: uppercase javascript

var str = "Hello World!";
var res = str.toUpperCase();  //HELLO WORLD!

Example 2: 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 3: js is letter

/^[a-z]+$/i.test(nom)

Example 4: check if something is a letter in js

string.charAt(1).toUpperCase() !== string.charAt(1).toLowerCase()

Tags:

C Example