Syntax for creating a RegExp object:1. var txt=new RegExp(pattern,attributes);2. var txt=/pattern/attributes;Which of the above mentioned syntax will correct?
1 only
2 only
Both 1 and 2
None of the above
Correct Answer : C
Which of the following type of variable is visible only within a function where it is defined?
Which of the following is the correct syntax to redirect a url using JavaScript?
Predict the output of the following JavaScript code.
var a="javascript"; var x=a.lastIndexOf("a"); document.write(x);