Clearest explanation I've seen of JavaScript's idiosyncracies, especially the closure aspects.
@JustinGordon80811 жыл бұрын
Nice refresher on the madding syntax of OO-javascript.
@NathanPhelpsMcPhelpsius11 жыл бұрын
Exceptionally well done and useful. Thanks. JavaScript OO has been driving me in crazy circles
@travist34911 жыл бұрын
Thanks for the correction. I will refer to your comment in the annotations.
@travist34912 жыл бұрын
You are right. they behave the same. So, anti-pattern may be to harsh. However, I prefer defining functions through assignment because you are being explicit about its context. It is also more consistent since there are many cases when you are forced to assign a function to a variable,like in object literals. Because of this,I consider function declaration through assignment a more consistent pattern, and not necessarily an anti-pattern. Thanks for your input! Good point!
@ramg92639 жыл бұрын
In the colors printing example(video stream:23:55) why did you return the function inside anonymous function. I have written like below it's working fine. var clrs=["red","blue","yellow","green"]; for(var i=0;i
@widebandrecords9029 жыл бұрын
Working fine and working in code that sits with over 100 other lines of code is two different things totally.. Javascript is evaluated and compiled on the fly before it is run..
@sagaruv12 жыл бұрын
You did a great job bro.... I liked your narration and the way you presented the topic. Cool...
11 жыл бұрын
in js how can i execute another js function from inside another function so that if i wanted to i could do 2 functions if conditions are met its for a chat app im making so a sound fx is hurd on new messages?
@SultanShakir11 жыл бұрын
I see this was done a year ago. So maybe that is why I am getting different outputs in my Chrome console. Maybe I have some other setting enabled. I don't know. Do you know what version of Chrome you were using at the time?
@nquinn7218511 жыл бұрын
That's due to hoisting. All variables and functions get pulled to the top of it's scope. In that case your better off declaring the function as a variable declaration. function container_fn(){ var abc; if(x){ abc = function(){ y=z; } }else{ abc = function(){ y=a; } abc()}
@widebandrecords9029 жыл бұрын
Great video Travis!!!!
@VicVlasenko12 жыл бұрын
thanks. example with prototype was very useful.
@heyhelloallpeople12 жыл бұрын
Thanks you very much and this tutorial very helpfull! and easy for beginners learn to JavaScript! Also I'm watched your from Azerbaijan, Sir!
@KEFFAK12 жыл бұрын
regarding the this pointer. Say we have the function test defined as: function test(){ console.log(this); } we can just say var hello = new test(); and then this will be assigned. So why is declaring a function as function test() anti-patern?
@viktorlubchuk137210 жыл бұрын
very nice and instructive lesson. thank's Travis
@MrStimpy7711 жыл бұрын
I just learned a use case where "function x()" is problematic. In this example: function container_fn() { if (x) { function abc() { y=z; } } else { function abc() { y=a; } } abc(); } I just learned that the runtime will actually vary between browsers, and typically both functions will be pulled out of the condition block and put at the top. // engine unpredictably generates: function container_fn() { function abc() { y=z; } function abc() { y=a; } if (x) {} else {} abc()
@wallisafza10 жыл бұрын
awesome... nice to watch the video...
@jolres12 жыл бұрын
The reason why the first example did not work was because you were doing this: console.log('Travis'.length); as opposed to this: console.log(myvariable.length); I know you probably figured this out by now. But I posted it just in case and for others to see.
@FrankMarti12 жыл бұрын
Thanks for the upload! Very helpful!!
@deanshelton91310 жыл бұрын
Aren't string keys required as a valid JSON spec?
@asdqwe44279 жыл бұрын
Yes they are. An object literal is not a json string. He should have been clearer on that. They map very all to each other, but they are not the same thing.
@irv1409 жыл бұрын
How can you call a function if you didn't first give it a name? Possible?
@travist3499 жыл бұрын
irv140 You can either pass it to another function as a "callback" argument, which it then assigns to a variable to be called later, or you can call it immediately as a self-executing anonymous function as I explain in this video.
@vivametal66611 жыл бұрын
Gracias amigo saludos desde México
@santosharakere10 жыл бұрын
Great video. Thank you. - Santosh
@dongdongzheng12 жыл бұрын
This is awesome!
@harryjandu982710 жыл бұрын
Could you make a tutorial on modal popups that use constructors and inheritance without using jQuery plugins, more like a small tutorial on how to make a plugin that makes modal popups.
@TheChipBandit9 жыл бұрын
I think on 20:00 you forgot the brackets of the getname function,should have written person.getname(), Great vid,10x
@KhadijahCelestine10 жыл бұрын
I love live debugging!
@MrStimpy7711 жыл бұрын
36:50 is wrong. var myfunc = function() { .. }; .. and .. function myfunc() { .. } .. are actually the same in the JS runtime, and the 2nd *is* scoped to the closure, NOT globally, and it is still a variable, the only diff is that the 2nd shows up in a stack trace with its full name. Therefore, I recommend the latter when mid-block. The only reasons to perhaps avoid it are because it is not JSONable and less visually obvious that it is indeed a local variable. jsfiddle -dot- net /vzFT2/2/
@stepshashaydy10 жыл бұрын
Awesome! :)
@kuraibankusu10 жыл бұрын
Great vid thanks
@NosniborNitram11 жыл бұрын
Learnt more about debugging there. Thanks anyway
@sandeshsmagdum10 жыл бұрын
Thank Travis, I created a jsfiddle based on this presentation. The following is the jsfiddle URL: jsfiddle.net/sandeshsm27/3NHDE/
@ThijmenGThN4 жыл бұрын
I never understood why people do: “let array = new Array”, isn’t it just easier to do: “let array = []” ?
@nicholasaurus9 жыл бұрын
I wish you wouldn't have called the element you are targeting 'context' that is incredibly confusing since context is also how people refer to 'this.'
@travist34911 жыл бұрын
The version of chrome should not matter since they all basically use the same Javascript engine.
@mohamedfaried311 жыл бұрын
too small text it is not visible it is a big mistake
@xavorTM10 жыл бұрын
Its PERDECTLY vissible
@stepshashaydy10 жыл бұрын
Alexander Dimitrov In full screen sure but most people like to type as they watch and in this case it's not possible.
@duiffie3 жыл бұрын
... okay Trav ... you could be a welder ...
@edisomerovic382611 жыл бұрын
Who is this for? This is not for learning JavaScript. But for experienced developers who want to learn JavaScript. ???
@JustinGoldsmith11 жыл бұрын
It's funny your site is called allplayers but you only offer an iphone app. Cause if you own an Android device you're simply not a player. Thanks for the video, I'll use what I learned to build an Android app.
@AlibekKulseitov12 жыл бұрын
booooooring from 00:00 to 10:00. anyways very helpful
@olivercroomes11 жыл бұрын
I didn't find your tutorial helpful. From a beginner perspective, it seemed you were throwing around jargon without going into much depth. I tried to go with the flow of your presentation, but when you derive a topic from something you lightly addressed, and then you constantly mess up, you can be very hard to follow. Keep this in mind if you make another video. I mostly scraped your video for topics that I thought I should learn (such as patterns).