Set - 4

Question 11 :

How do you create a new object in JavaScript?

Answer :

var obj = new Object(); or var obj = {};


Question 12 :

How do you assign object properties?

Answer :

obj["age"] = 17 or obj.age = 17.


Question 13 :

What's a way to append a value to an array?

Answer :

arr[arr.length] = value;


Question 14 :

What is this keyword?

Answer :

It refers to the current object.


Question 15 :

What does the term sticky session mean in a web-farm scenario? Why would you use a sticky session? What is the potential disadvantage of using a sticky session?

Answer :

Sticky session refers to the feature of many commercial load balancing solutions for web-farms to route the requests for a particular session to the same physical machine that serviced the first request for that session. This is mainly used to ensure that a in-proc session is not lost as a result of requests for a session being routed to different servers. Since requests for a user are always routed to the same machine that first served the request for that session, sticky sessions can cause uneven load distribution across servers.