Web Development Question:
Download Job Interview Questions and Answers PDF
Give example of using Regular Expressions for syntax checking in JavaScript?
Answer:
var re = new RegExp(" ^(&[A-Za-z_0-9]{1,}=[A-Za-z_0-9]{1,})*$" )
var text = myWidget.value
var OK = re.test(text)
if( ! OK ) {
alert(" The extra parameters need some work. Should be something like: " &a=1&c=4" " )
}
var text = myWidget.value
var OK = re.test(text)
if( ! OK ) {
alert(" The extra parameters need some work. Should be something like: " &a=1&c=4" " )
}
Download Web Development Interview Questions And Answers
PDF
Previous Question | Next Question |
How you read and write a file using JavaScript? | How to submit a form using JavaScript? |