In JavaScript, which of the statements below can be used for string declaration?
ID: 3545146 • Letter: I
Question
In JavaScript, which of the statements below can be used for string declaration?
1) var cst="PHPKB Knowledge Base Software";
2) var cst=new String("PHPKB Knowledge Base Software");
a) Either (1) or (2)
b) Only (1)
c) Neither (1) nor (2)
d) Only (2)
What will be the output of following copde snippet?
<script type="text/javascript">
var cst = "Chadha Software Technologies";
var result = cst.indexOf("Tech");
document.write(result);
</script>
a) 15
b) 16
c) 19
d) 17
What will be the output of following copde snippet?
<script type="text/javascript">
function x()
{
var s = "Eat to live, but do not live to eat";
var pattern = new RegExp("eat$");
document.write(pattern.exec(s));
}
</script>
a) Eat
b) eat
c) undefined
d) Eat eat
Explanation / Answer
a,b,b
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.