Tata AIG General Insurance Company - Insurer Innovation Award 2024
JavaScript Functions
1.
2.
3. The Basics var square = function ( x ){ return x * x ; } square(5) Function reference Function keyword Arguments Code body Return value Jupiter IT
4. 3 Ways to Declare a Function var f = function (){ alert ( 'hi' )} function f (){ alert ( 'hi' )} window . f = function (){ alert ( 'hi' )} Jupiter IT
5. Everything is an Object I ask "girl can I have closures, canvas, advanced features for my project?" You say "sure, but keep it simple, everything is an object" I say "JavaScript you've come a long way from copy-paste hacks" You blush "I know, but please, call me AJAX" -- Digital Crush Jupiter IT var f = function ( a , b ){ return a - b }; var g = “hi”; var h = 1;
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
Editor's Notes
By the end: Understand complex JS code Be comfortable with passing functions around like its nothin Have a decent understanding of closures and how to use them Fully “Functional”