String Manipulations and queries in JavaScript
after a string variable was created as
var myString = 'Guy Maimon'
Sending a query of will return explaination
myString.length
10 Returns the length of thestring
myString[2]
y Returns a specific char from a string (0 based)
myString.indexof('imo')
6 Returns where the typed string starts from
if not found, will return -1
myString.includes('imo'))
TRUE Returns TRUE if exists somewhere
otherwise Returns FALSE

if(myString.indexOf('Ma') !== -1)
{
    console.log("It's There");
}else{
    console.log("It's not There");
}; 
It's There if(myString.indexOf('test') !== -1)
Returns Ture if the exists in the string
if not found, will return -1
myString.toLowerCase()
guy maimon converst all text to lower case
myString.toUpperCase()
GUY MAIMON converst all text to upper case
myString.slice(5)
imon Returns string after cutting # chars
does not change the variable
myString.slice(5,7)
im Returns string after cutting #1 chars
Returns all the chars until #2
does not change the variable
back to main page