in Technology by
Predict the output of the following JavaScript code. var a="blogsforblog"; var x=a.lastIndexOf("b"); document.write(x); A) 8 B) 0 C) 9 D) Error

1 Answer

0 votes
by
Ans: A Explanation: The index starts with 0 in JavaScript. Here, x searches for the last occurrence of “b” in the text.

Related questions

0 votes
    Predict the output of the following JavaScript code.
    Code A: var x = 10; y = --x + 1; alert(y); Code B: var x = 10; y = x-- + 1; alert(y); What is the output for code A and B? a)10,11 b)10,10 c)11,10 d)11,11...
asked Oct 8, 2020 in Technology by JackTerrance
0 votes
    Predict the output. Hi {{name}}. is used with the context variable: var context = { "name" : "< b>Jane Roe< /b>" } (1)Jane Roe ... display (3)< b>Jane Roe< /b> (4)< b>Jane Roe< /b>...
asked Aug 17, 2021 in Technology by JackTerrance
0 votes
    Which of the following is useful way to put text, code, data, output all in one document? (a) ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 31, 2021 in Education by JackTerrance
0 votes
    What is the HTML tag under which one can write the JavaScript code? A) B) C)
    1. Predict the output of the following operations if x=5 and y=3. x>=10&& y>=4 f. x>=1 || y>=4 Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    Predict the output of the following code snippet function foo(input: boolean) { let one = 1200; if (input) { let ans ... 1. 1201 2. Undefined 3. Compilation error 4. Runtime error...
asked Jun 29, 2021 in Technology by JackTerrance
0 votes
    What is the output of the following expression? function multi(x,y) { var c = x*y; } multi(20,3); 1. 20 2. 60 3. 3 4. Nothing...
asked Feb 25, 2021 in Technology by JackTerrance
0 votes
    What is the output of the following expression? function multi(x,y) { var c = x*y; } multi(20,3); A) 20 B) 60 C) 3 D) Nothing...
asked Oct 9, 2020 in Technology by JackTerrance
0 votes
    Which of the following tool can be used for integrating text and code in one document? (a) knitr (b) ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 29, 2021 in Education by JackTerrance
0 votes
    (i) x=5, y=6,2=20 Q8) Consider the following statements and describe the output/statement required: ... multiple assignment statements. Select the correct answer from above options...
asked Nov 27, 2021 in Education by JackTerrance
...