Skip to main content

some more javascript learning

1. Label : any javascript statement including loops, conditionals, curly brackets blocks etc.,
a. Break:label; will take you to safety of label block
2. The break will bring you out of loop and continue will take you to new iteration in loop skipping the lower block. Continue first goes to increment than to condition statement in for loop whereas in while loop it goes to condition test directly.
3. Scope chain - every execution context has it. At top level its global and if not found object is undefined. In nested it includes the function call objects. The search begins in lowest scope and spreads out.
4. Create objects -- use object literal (comma separated property name value in curly bracket). An empty {} will declare a placeholder for referring object.
5. Object.property=value; is identical to object[property]=value; The first is used when you know name of property beforehand. The second is used for dynamic creation of property names.
a. Use double quotes when naming property inside [].
b. This is called as associative array and is generally iterated using
for(prop in objectarray){value=objectarray[prop];}
6. Create arrays - use array literals (a comma separated items in []).
a. The items maybe arbitrary expressions. They can embed object literals {}.
b. The length property is read(to know)/write(to expand).
7. String functions like sort, concat, split and splice modify array in place. Push and pop work at end of array and shift/unshift at start of array.
8. Nested functions declared using function keyword (statement--> function f(){return;}) can be in main body {} of function .
a. Function literals (var f = function(){return;})can come if conditionals and loop. They are like expressions only and require no name.
b. They can be named too like var x=function f(){return f();}. The reference to function is stored in x but it allows f to call itself by same name.
c. var ten = function(a){return a*a}(10);//ten is number.
d. var ten = function(a){return a*a};//ten is function().

Comments

Popular posts from this blog

Shivani, Brahmakumaries and Aastha channel

She comes twice on TV from 7:10 PM to 7:40 PM and 10:30 to 11:00 PM on Aastha channel. The spiritual channel story in India is on same lines as that of Aaj Tak , which was run by local ads before the big boys put ads on them. Today Shivani, a Brahmakumari mentioned that 99% of the cause of anger and frustration is elsewhere, it is not in the spur of the moment, when you hurt somebody or get hurt by somebody. Instead of reacting instantaneously , or pestering the reaction in the mind post the incident till eternity , can you wonder "Why is that soul so angry, what is bothering her? I am sure there is something more than what she has told me now?". The chain of thoughts that emerge lead you to compassion, releases love vibrations into the air. Love has a very subtle medium to reach out. You cannot yell and throw around love and claim that you are helping somebody by your love. You have to surrender to love and let love take over. You cannot correct the world. You can onl...

Success is exchange of energy

The definition of success is very elusive. It means different things in different phases of life to different people. When I was in school and college it was to pass somehow. When I was in 12th it was to get into engineering somehow. When I was in job it was to make more money anyhow. When you were in marriage it was to demand happiness and feel proud in pronouncing to yourself that every act of a frustrating job was for the sake of family and their well being. I was focusing on doing. I was focusing on achievement. So whenever I reflected back in life I always felt less. I could have been an IITian, I could not crack CAT. I could not join an organization during their early stock offer days. I could not go to US and earn in dollars. I simply missed doing too many things.  Now I feel lack of achievement. Now I feel lack of doing. Did I miss out on something while I was undergoing all this doing? Why was I nervous all this while? Why did one achievement led to other? Why...

pay bbmp property tax online 2009-10

A neat way to pay property tax online if you have a property in bangalore. As launch offer BBMP is not charging extra on credit card payment. You can go to http://218.248.41.198/ and choose form IV or V depending on whether there has been any change in your property from last year. You will need Application number from assessment year 2008-09. The number on top right corner of pink form. If you are lucky to have saved it to your files. Not the white receipt. You will reach a pre-filled form which either you can print to pay in nearest BBMP center or if you have started to trust online gateways and carry a credit card then choose to pay online. Remember to note down the new application number NOW. You never know when you will need them. Online option will lead you to IDBI gateway and there you need to have your credit card handy, your tax details comes pre-filled. You are done with the payment in your cosy little bed. Time for the receipt. You have still not invested in printer. Okay,...