Then you can sequence.

 
Ruthenberg: I was messing around today with execution context and closure stuff and I came across to this, I thought it wouldn’t work, I thought it should log out undefined value, but to my very much surprise it does work! o_O http://jsbin.com/surotisowi/edit?js,console

Pauza: Just so you can understand my frustration, i’m dealing with code that has functions for ‘setDayMonday’, etc.

Leverson: AramKaram, why wouldn’t it work?

Rische: I’ve made a Fiddle, where I’m experimenting with the “html5sortable” jQuery plugin to make an ol draggable. I’m trying to add two things: 1 delete remove an li by dropping it into a div id=”trash”, and 2 add an li which also becomes draggable. Please see http://jsfiddle.net/jokke/uxp12bjv/

Kinnaird: Leverson well, my mentality was that since we are copying this anonymous function and pushing it to an array, running it would give error cause it wouldn’t be able to access the a since they are in different scopes at that point, when we push the function to the array that functions happens to be in global scope from now on, then if so, how can a function in global scope access a variable from another function that has its own

Kearley: Variable, in this case a ?

Clore: I am familiar with JS, but not with jQuery. I realize this is maybe a big question, but maybe you can give me some pointers as to why my Fiddle does *nothing* on dropping into the “trash” div?

Leverson: AramKaram, I think you are overthinking it. Whenever you reference a variable in the outer scope you create a closure, this closure lives outside of the function

Derenzo: Leverson hmm this is strange but good to know this how it works : I thought only returning a function from a function that forms a closure, turns out you can even do this way and it works just fine :-/

Sarrett: AramKaram: from javascripts perspective there’s no difference between the two

Sarrett: AramKaram: its a function with a closure that’s being p***ed/returned somewhere

Villaescusa: Sarrett so as long as I reference my desired variable from outer function, in my case this variable a and return the function/save/push the function that references it this means it’ll still work regardless from where I might call it, right?

Roeker: Ok, I fixed the add a new item + make it draggable, by “restarting” the html5sortable plugin

Matkowski: Hmm, very interesting: the same is true for an object, i just ***ign the function to a property in an object and called it from there and it still worked o_O

Gull: AramKaram: lexical scope depends on where the function is *defined*, not where it’s referred to

Overstreet: Gull got it: thanks for clarification

Billeter: Http://paste.ee/p/Oms03

Wowk: Hello, I like to login to ebay with javascript.

Lepretre: Thoughts? http://fiddle.jshell.net/550n1gp9/5/

Leverson: K2gremlin, indentation is *****ed up

Leverson: Those are my first thoughts.

Ducos: Http://fiddle.jshell.net/550n1gp9/6/

Leverson: K2gremlin, this name == null name == “”, not great

Wynkoop: Just checking for blank.

Gull: Hudo: why does every line start with “javascript:”?

Leverson: Value will always be a string, you can do if !name

Konopacki: K2gremlin: boolean true

Leverson: If !name is shorter, and more correct

Hammacher: So the entire line would be if !name { ?

Fagley: Im using the oracle apex framework, where you may use also javascript. There are special “fields” where to write the code, and the syntax in some fields is, to preceed each line with javascript:

Mugg: Er, plus some more i guess

Berringer: The structure of the programm in general is okay, with others sites it works, I think some links are wrong, maybe action , or Im missing something

Leverson: K2gremlin, the rest looks ok. I would separate the logic from the querying

Leverson: So a validation is a function that takes an argument, and returns true/false

Leverson: Then you can sequence those, and thread the error if any