i want to check particular character occurrence in a string java script,
following is what i need
- if the string having only one dot(.) between the string i have to alert
it is a object
eg:var text = 'ABC.DEF'; - if the string having open and closing brackets
()at the very end of the string i have to alertit is a function
eg:var text = 'ABC()';
i tried this
if(text .indexOf('()') === -1)
{
alert("not function");
}
but how i can check whether brackets are in very end.
foo.bar()? Orfoo.position().top?.and()? Where does it belong?