- What are the difference between HTML4 and HTML5 ?
- What are the new features in HTML5 on which did u work on it ?
- What are the new tags in HTML5 ?
- What is the difference between simple cookies and new storage mechanism in HTML5 ?
- Need to find out an output of a new for loop code with 'continue' and 'break' ?
- Need to find out output of a new java script with createElement and binding with HTML listener code ?
- Simple code for setting up cookies with javascript ?
Create a Cookie with JavaScript
JavaScript can create cookies, read cookies, and delete cookies with the property document.cookie.With JavaScript, a cookie can be created like this:document.cookie="username=John Doe";You can also add an expiry date (in UTC or GMT time). By default, the cookie is deleted when the browser is closed:document.cookie="username=John Doe; expires=Thu, 18 Dec 2013 12:00:00 GMT";With a path parameter, you can tell the browser what path the cookie belongs to. By default, the cookie belongs to the current page.document.cookie="username=John Doe; expires=Thu, 18 Dec 2013 12:00:00 GMT; path=/";
Read a Cookie with JavaScript
With JavaScript, cookies can be read like this:var x = document.cookie;document.cookie will return all cookies in one string much like: cookie1=value; cookie2=value; cookie3=value; - How a private variable implementation with javascript ?
- How to create a simple object with javascript?
Creating a Direct Instance
The following example creates a new instance of an object, and adds four properties to it:Example
person=new Object();
person.firstname="John";
person.lastname="Doe";
person.age=50;
person.eyecolor="blue";- Alternative syntax (using object literals):
Example
person={firstname:"John",lastname:"Doe",age:50,eyecolor:"blue"}; Using an Object Constructor
The following example uses a function to construct the object:Example
function person(firstname,lastname,age,eyecolor)
{
this.firstname=firstname;
this.lastname=lastname;
this.age=age;
this.eyecolor=eyecolor;
}Creating JavaScript Object Instances
Once you have an object constructor, you can create new instances of the object like this:var myFather=new person("John","Doe",50,"blue");
var myMother=new person("Sally","Rally",48,"green");- What is closures in javascript ?
- What are the difference between CSS and CSS3 ?
- What are the events in javascript ?
- How to implement OOPs in javascript ?
Events in javascript
Input Events
Mouse Events
Click Events
Load Events
Others
- Need to find out an output of a new for loop code with 'continue' and 'break' ?
<html>
<body>
<p>Click the button to do a loop with a break.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction()
{
var x="",i=0;
for (i=0;i<10;i++)
{
if (i==3)
{
break;
}
x=x + "The number is " + i + "<br>";
}
document.getElementById("demo").innerHTML=x;
}
</script>
</body>
</html>
- Need to find out an output of a new for loop code with 'continue' and 'break' ?
<!DOCTYPE html>
<html>
<body>
<p>Click the button to do a loop which will skip the step where i=3.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction()
{
var x="",i=0;
for (i=0;i<10;i++)
{
if (i==3)
{
continue;
}
x=x + "The number is " + i + "<br>";
}
document.getElementById("demo").innerHTML=x;
}
</script>
</body>
</html>
Look at some more UI Interview questions http://jharaphula.com/ui-developer-interview-questions/.
ReplyDelete