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

Final Group Sadhana with HariHaran Mani

Today's meditation was drive down the memory lane. The events of the past few months/years simple drizzled in and out. The location had been flat#508 Cassia block in Brigade Millennium. The flat was on rental by  +Hariharan Mani , an +Art of Living  teacher, actuarial practitioner and meditator from Mumbai. It was here that we began our Group Sadhana about a year and half back. Today's idea was from  +Balakrishnan Ganesan  and original idea was from Shuchi. All of us are in photo above. Yesterday Bala said, lets do it for one last time. He messaged again that we had to bring our own yoga mats. There was a time when we had kept one carpet for morning Group Sadhana at Hari's flat. People joined and left us at different points of time. I remembered that Agnihotra Homa was to be performed at sunrise so messaged back that my entry would be delayed. In the end we gave a moist eyes good byes to Mr Hari and his bangalore stay. His memories and common moments will remain wi

सोहम का महत्व - live ashtavakra by Sri Sri RaviShankarji

मैं वही हूँ. न मैं त्रितिये व्यक्ति मैं हूँ, न द्वितीये व्यक्ति मैं हूँ. मैं खुद खुदा हूँ. सो हम. यह नाम तुम्हे दिया गया है. यह तुम नहीं हो. एक बार एक संत जंगल के बीच मैं अपनी झोपड़ी मैं थे. तब वहां कोई ढेर सारा खाना लेके आ गया. उन्हें हैरानी हुई कि ऐसा क्यूं हुआ. तभी वहां ३-४ लोग आये ओर उनसे कहा कि हम भूखे हैं, हमें भोजन चाह्यिये. संत  ने कहा कि मिल जाएगा. वह लोग हैरान हुए ओर कहा कि यहाँ तो कुछ नज़र नहीं आता है. तब संत ने कहा कि "सच है कि मेरे पास कुछ नहीं है, लेकिन मैं जिसके पास हूँ उनके पास सब कुछ है. "   माँ बच्चे  को जन्म देने से पहले ही उसमें दूध आ जाता है. प्रकृति का नियम है कि जहाँ प्यास होनी होती है वहां पहले से पानी व्याप्त होता है. यह दूसरी बात है कि आपको  दीखता नहीं है.   आप पूर्ण हो क्यूंकि आप पूर्ण से बने हो ओर पूर्ण मैं रहते हो ओर पूर्ण मैं जाना है. पूर्ण मैं से पूर्ण को निकालने से क्या पूर्ण अधूरा हो जाता है. आप अकेले से बोर क्यूं होते हैं, क्यूंकि आप ने अपने आप को नीरस कर दिया है. आपके पास जिस परमात्मा को होना था वह आपको कहीं ओर दीखता है. आपके पास