use string as a variable in javascript code example
Example: how to use string variable in javascript
<html>
<head>
<title>JavaScript Strings</title>
</head>
<body>
<script>
var re = "java";
var str = "Learn java";
if ( str.search(re) == -1 ){
document.write("Not found!" );
} else {
document.write("Found!" );
}
</script>
</body>
</html>