Angularjs interview questions
What is dom?
Dom means document object model is a representation of HTML web page in objects relationship model.
Java scripts manipulate HTML elements in the help of DOM methods.DOM can access Html elements ID’s class, tag names to and modify and delete Html elements.
It can set CSS properties values.
2. How methods we have to access DOM elements?
The three main DOM methods to access Html elements.
1.get Element BY ID()
2.get Element BY class()
3.get Element BY TagName()
3.2+4+”3″?
4. What is use of number?
Number function is used convert a value of character to number format in java script
5.print 2 4 6 8 10 12 ?
<script>
n=2;
For (i=2;i<=2;)
{
document.write (i);
i=i+n;
}
</script>
6.what is the function?
Function is a block of code which contains JavaScript statments with a specific name and optional arguments
Ex:
<script>
Function Hello()
{
Document.write(Hello);
}
</script>
7.Difference between the while and Do-while and For?
While
This loop is used to execute the statement when condition is true
Ex:var i=10;
While (i=<10)
{
Document.write(i+”<br>”);
I+
}
Do-While
This loop is used to execute the statement when the while condition is true
Var i=11
{
do
Document.Write(i+”<br>”);
I++;
}
while(i<=10)
For
This is used to execute the statement when the condition satisfies.
It enter only when condition is satisfie.
8.print Following
1
1 2
1 2 3
for(i=1;i<=3;i++)
{
For(n=1;n<=i;n++)
{
Document.write(n);
Document.write(“<br>”);
}
9.print odd numbers upto 20 using for and while loop?
for(i=1;i<=20;i++)
{
Document.write(i+”<br>”);
}
No comments:
Post a Comment