I have noticed that when coding in javascript, it doesn't matter if i declare the function before or after i call it. In other languages it will cause an exception, but when running javascript in chrome it works just fine. Is that only in chrome, or is that normal?
            Asked
            
        
        
            Active
            
        
            Viewed 59 times
        
    1 Answers
2
            What you're seeing is function hoisting in action: http://elegantcode.com/2011/03/24/basic-javascript-part-12-function-hoisting
 
    
    
        pdoherty926
        
- 9,895
- 4
- 37
- 68
- 
                    1Basically, setting it as a variable makes the function only work after the variable is set, and declaring it with the function keyword directly makes it accessible from anywhere, anytime. – SeinopSys Feb 25 '13 at 20:11
