I remember back when I was learning how anonymous functions worked in Javascript I actually opened notepad and threw notes in their that i would review. Share any notes here, who knows, maybe the tricks you used to teach your newbie self will help others. I'll be adding to this as I have tons of PHP and JS notes on my older system. I will have to organize them for you though, I use to throw shit around like monkeys
HTML'S RANDOM NOTES (JS)
Javascript has a function dataType.
IE: assisgn a variable a function
__________________________________________________ ____Code:var doSomething = function (param, param2){ alert("anonymous function!"); };
IE: Pass a function a function
Code:var doSomething = function (param, param2, fn){ return fn(param, param3); };__________________________________________________ ____Code://The function we're going to pass to our anonymous function doSomething function sum(param, param2){ return param + param2; } //Pass the function we want to use. doSomething(4, 5, sum);
IE: Defining a function as a parameter.
*Note - Imagine that doSomething has THREE params upon instantiation.
_______________________________________________Code:var bar = doSomething(param, param2, function(param, param2){ return param * param2; }); _______
Immediately invoked function. Immediately invoke a function when you write code and
you no longer have trry about global variables, protecting your code from being
overwritten or misused.
Code:var foo = "Sup broski!"; //bad (function (){ var foo = "hello, window!"; //good alert(foo); }()); alert(foo);
Results 1 to 6 of 6
Thread: Did you guys ever take notes?
- 14 Dec. 2013 07:07am #1
Did you guys ever take notes?
Last edited by HTML; 14 Dec. 2013 at 11:02am.
- 14 Dec. 2013 04:37pm #2
- Join Date
- Apr. 2013
- Location
- Minnesota
- Posts
- 1,325
- Reputation
- 114
- LCash
- 1.36
I was just in a database class and didn't find a need to take notes.
I've got a handful of them when I was learning data-structures though.
I really like to practice programming and find that the best approach for myself.https://discord.gg/TvN6xUb ~ chat on discord pls.
- 15 Dec. 2013 11:39pm #3
lovely, sorry for my ocd but your indentation is a slight off.
not needed, but i love it being perfect.
Code:var foo = "Sup broski!"; //bad (function () { var foo = "hello, window!"; //good alert(foo); }()); alert(foo);
- 16 Dec. 2013 01:57am #4
I never took notes. If anything, I'd write a program with a method, and if I ever needed a refresher on how that programming method worked, I'd just checked the source on the program I wrote in the past. I learned everything as needed, instead of through tutorials, so I never really learned anything before I had a use for it.
- 16 Dec. 2013 09:26am #5
Moderator Bachelor of Science in Virginity
- Age
- 31
- Join Date
- Nov. 2009
- Location
- Toronto
- Posts
- 5,421
- Reputation
- 546
- LCash (Rank 3)
- 1.96
- 23 Dec. 2013 09:00am #6
I'm currently taking a few programming classes. I wish I had taken more notes in my first Java class. The professor was shitty and I didn't learn nearly as much as I thought I would. I really feel like I didn't take anything away from the class. Now I'm going into the next semester with pretty much no knowledge.