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

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...

तुम दीन नहीं हो - live ashtavakra commentary by Sri Sri Ravishankar ji

तुम वही हो. तुम सूर्य कि किरण नहीं, तुम उस किरण का विस्तार हो. तुम सूर्य हो.  जिस प्रकार सूर्ये अपनी किरणों को हर खिड़की के माध्यम से हर घर मैं भेजता है, उसी प्रकार परमात्मा अपनी पूर्णता को छोटी छोटी आत्मायों मैं भेजता है.  यह बात दूसरी है कि जब आत्मा अपने पुर मैं वास करने लगती है, अपने शरीर रुपी घर मैं रहने  लगती है तो भूल जाती है कि वह सिमित नहीं है, उसका विस्तार ही परमात्मा है.  लेकिन घर मैं घुसने के बाद आप कांच के टुकड़े मैं सूर्य का प्रतिबिम्ब देखते हो ओर अपने आप को सिर्फ एक किरण मात्र समझने लगते हो. जरा बाहर झाँक कर भी देखो, सूर्य का अनुभव तो करो. तुम्हारे आस पास भी वही सूर्य का अंश है. तुम्हारे पड़ोस मैं भी वही सूर्य कि किरण है, तुम्हारे गाँव मैं जो रिश्तेदार हैं वहां भी वही सूर्ये है. सूर्य कोई भेद भाव नहीं करता. तुम क्यूं ऊँच- नींच मैं पड़े हो.  तुम्हारे दुःख का कारण  क्या है. तुम गुरु से तो मिले हो. तुमने गुरु को साक्षात् किया है. लेकिन तुम संपूर्णतः यह निश्चय नहीं कर पाए हो कि येही सत्य है. पूरे भरोसे कि कमी होने से ही दुःख होता है....

Pay Online Property Tax Bangalore BBMP

Once again the time comes to pay tax to government . I called Mr. Shivappa who offers his services after office hours to residents of Brigade Gardenia. He asked me to come to the newly constructed BBMP help center in RBI layout, behind Capital School on 2nd Main. I could not locate it the first time and the good old postman on the Luna asked me to sit behind him and turned back from his onward journey of dropping letters to show me the place. To our dismay the help center was right in front of us after 2 sec ride. Mr. Shivappa who had explained me the address of the place and also asked me to come there with previous two years receipt, khata and blank cheque . I requested him to disclose the amount so that I can pay it online. He did not. He asked my the flat area and then ignored my bodily existence. When I was in front of him requesting the same information he suddenly stopped understanding my Hindi and English . A good samaritan who was standing nearby explained to him that...