Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

General JavaScript

Featured Replies

Thank you a lot! I think i will keep in mind prototype only for my knowledge. I will play more times with call, apply, bind, var outer and var foo above. I feel, that i will need this constructions very often. It was very informative day, indeed:)

 

Look into frontend masters. The JS courses on there are far, far better than anything I can teach you.

  • Replies 422
  • Views 70.5k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • As soon as I saw the JS videos with that Mattias guy, I knew who he was straight away. He posts some really useful answers on Quora. I'd advise signing up if you haven't already. I've wasted hours re

  • Console.table, ladies and gentleman http://jsfiddle.net/juu5fx82/.   You need to use the JS console obviously, and hit 'run'. I never knew this existed.

  • jQuery's modular, you can build a custom version via Grunt, its pretty simple.   Before v3.0, which now uses requestAnimationFrame and Promises/A+, I'd use a build without Effects and Ajax with Velo

  • Author

 

His whole video series is very good. I asked him to do a video on promises, hopefully he'll make one soon :)

 

I sent him a tweet saying he should do a Frontend Masters course. It would be amazing to have something below the 'hardcore functional programming' one. That one is a bit to much for me. I would envisage it being hilarious too.

 

I sent him a tweet saying he should do a Frontend Masters course. It would be amazing to have something below the 'hardcore functional programming' one. That one is a bit to much for me. I would envisage it being hilarious too.

 

Yeah, that course is pretty hardcore and too much for me too. Apparently FEM only use teachers from USA right now. I asked them about doing a CSS course with Harry Roberts and that's what they told me.

Eric Elliott

just tweeted about his new books: here and here.

Maybe good to see. He is talking about "isomorphic" and "RESTful hypermedia services with Node.js". in his books. In job ads i often see about RESTful API skills.

Edited by fleur

Eric Elliott

just tweeted about his new books: here and here.

Maybe good to see. He is talking about "isomorphic" and "RESTful hypermedia services with Node.js". in his books. In job ads i often see about RESTful API skills.

 

I've got his book, it goes really advanced. I highly recommend you read something like Kyle Simpsons you don't know JS series beforehand. I just did a live course on building RESTful APIs in Node and I can tell you I struggled towards the end.

  • Author

Eloquent Javascript covers HTTP, Node and API's in the last few chapters. It's a long book, and really challenging. It has taken me a few months just to get through the first 6 chapters and exercises.

 

http://eloquentjavascript.net/21_skillsharing.html. It may look like a basic tutorial, but you would have covered a lot of JS by this point.

Fizzbuzz is really tricky, indeed!:) Not all, but exactly one part. I think, I understand, but can't write the same by myself. I passed test only with loop. Without loop it's toooooo much complicated:)

 

Is this part called Recursion, the important part of functional programming, right?

loopThrough = (function loopThrough(i, max, str) {
  str += '\n' + testNums(i);
  if (i < max) {
    return loopThrough(i+=1, max, str);
  }
  console.log(str + '\n');
})(1, 100, '');

exactly this

if (i < max) {
    return loopThrough(i+=1, max, str);
  }

yes, recursion is when a function calls itself. It's not really a part of functional programming per-se functional programming is all about high-order functions, almost all languages can do recursion but many do not support high-order functions.

 

That said recursion is still a good concept to learn, although I don't understand why people find them much more difficult than loops, it's a very similar mechanism to a loop when you visualise it.

yes, recursion is when a function calls itself. It's not really a part of functional programming per-se functional programming is all about high-order functions, almost all languages can do recursion but many do not support high-order functions.

 

That said recursion is still a good concept to learn, although I don't understand why people find them much more difficult than loops, it's a very similar mechanism to a loop when you visualise it.

 

Thank you for explanation! Not only recursion, all construction with many functions inside one function in code was difficult, but very interesting to learn!

Just to bear in mind, Javascript is pretty complex there's loads on nuances, I recon I've clocked up well over a thousand hours of direct study and there's still loads I don't know. Don't get too disheartned if you're finding it hard, just keep on studying and you will learn. I remember closures took me AGES to understand, although I didn't help myself trying to learn them without learning variable scope in JS beforehand :/

 

I would expect for an average person it's gonna take like 1500-2000 hours to get to the level that JS engineer roles require, most JS engineers started out in frontend roles and developed into to more specific JS roles as they gained experience.

The entry level for a junior front-end developer is FAR lower than a dedicated JS engineer, and might be worth a look if you need work sooner - you can learn more js while on the job. Like any kind of engineering it requires very in-depth knowledge.

Edited by rbrtsmith

 

Nice article!

 

Must admit I rarely find myself writiing loops now with all the nice array methods that ships with ES5, I think they're far more readable and more inline with functional programming :)

Edited by rbrtsmith

  • Author

 

Nice article!

 

Must admit I rarely find myself writiing loops now with all the nice array methods that ships with ES5, I think they're far more readable and more inline with functional programming :)

 

Without a doubt. I'm glad ES6 added a bit of syntactical sugar too, the language needs it in some places.

 

In other news I grabbed 'Javascript Interview Questions' for free on Frontend Masters. You can't really beat free stuff.

 

Without a doubt. I'm glad ES6 added a bit of syntactical sugar too, the language needs it in some places.

 

In other news I grabbed 'Javascript Interview Questions' for free on Frontend Masters. You can't really beat free stuff.

 

Yeah, those Qs get hard! This is why I was saying to Fleur that the barrier to entry for a JS dev is FAR higher than a front-end dev, and it's reflected in the higher wages you see too. As much as I love JS though, I enjoy writing CSS and creating UIs too, not sure I'd wanna give that up!

  • Author

 

Yeah, those Qs get hard! This is why I was saying to Fleur that the barrier to entry for a JS dev is FAR higher than a front-end dev, and it's reflected in the higher wages you see too. As much as I love JS though, I enjoy writing CSS and creating UIs too, not sure I'd wanna give that up!

 

I've flicked through the book, and there seems to be some really solid advice on interviews in general, and the expectations. I haven't read any of the chapters yet though, but it's there if I ever need it.

 

Without a doubt. I'm glad ES6 added a bit of syntactical sugar too, the language needs it in some places.

 

In other news I grabbed 'Javascript Interview Questions' for free on Frontend Masters. You can't really beat free stuff.

 

You are very lucky! I tried to grab this book after your post, but failed. I wish i had no hacker skills:)) I have heard, that for to test js skills js dev can create calculator, calendar, login panel, private admin panel for users, transfer data via Ajax, manipulate with JSON and so on.

 

Yeah, those Qs get hard! This is why I was saying to Fleur that the barrier to entry for a JS dev is FAR higher than a front-end dev, and it's reflected in the higher wages you see too. As much as I love JS though, I enjoy writing CSS and creating UIs too, not sure I'd wanna give that up!

 

 

Yes, i keep in mind your advice! Today i tried to solve this test for junior js dev but couldn't solve 3 and 4 examples. It was really hard! :)) Finally i want to have ability to create this. I didn't see the junior js position in my place, only middle (front-end or js developer) with strong Angular or React skills. But you said that it's better to understand js before. That's why i decided to go for interview as web master, because i have this knowledge now and keep learning js in the evening. Now i am not shure, how i can divide my free time yet. :)) But after i saw the ability js (not iQuery) in creating my lovely animation and app, i decided to learn js as much as possible.

Edited by fleur

Seriously Fleur my advise would be to try and get a junior role as a Front-end dev and not JS a junior. A JS dev is usually somebody who was previously a senior front-end with a number of years of experience. It takes years of constant JS practice to get a job as a JS engineer, and it's not all about tests in an interview, most will want to see what you have worked on, your github account etc. See your understanding of the lesser known parts of the language.

 

But I fear you'll really struggle to get a JS specific role at this stage, Look into Front-end and improve your JS skills on the job is what I'd advise, then maybe a few years down the road you'll be ready for a JS engineer type role. I'll repeat again the barrier to entry for a Front-end dev is far lower than a JS engineer.

Edited by rbrtsmith

  • Author

 

You are very lucky! I tried to grab this book after your post, but failed. I wish i had no hacker skills:)) I have heard, that for to test js skills js dev can create calculator, calendar, login panel, private admin panel for users, transfer data via Ajax, manipulate with JSON and so on.

 

If you're a FEM member then it should appear in your messages (the circle in the bottom right). Otherwise message Marc if you weren't able to download a copy.

Seriously Fleur my advise would be to try and get a junior role as a Front-end dev and not JS a junior. A JS dev is usually somebody who was previously a senior front-end with a number of years of experience. It takes years of constant JS practice to get a job as a JS engineer, and it's not all about tests in an interview, most will want to see what you have worked on, your github account etc. See your understanding of the lesser known parts of the language.

 

But I fear you'll really struggle to get a JS specific role at this stage, Look into Front-end and improve your JS skills on the job is what I'd advise, then maybe a few years down the road you'll be ready for a JS engineer type role. I'll repeat again the barrier to entry for a Front-end dev is far lower than a JS engineer.

 

Agree this you. For to fit in dev team i need to know at least one MVC framework (Angular is most famous). That's why i try to understand js better. JS tasks is really fun. When i solve this task its pleasure.:) Now i test the market where i can fit. Its interesting journey.

Absolutely keep on learning JavaScript- but don't think you HAVE to know a framework to get a job, I didn't when I got mine, for most websites a framework is total overkill, just some developers rely on them because they don't know JavaScript to well and can barely create a click handler without a framework like Angular.

 

These frameworks are most useful when you're building more app type projects, but there's plenty of agencies that just do websites, maybe look at those for your first gig.

 

Don't waste your time learning Angular 1.~either, version 2 will be released soon and it's API will be very different. I'm spending my time learning React, I think that has great potential.

Edited by rbrtsmith

I collected your advice and now learning js. It will take time for me. I am planning to start React or Angular in the autumn. I am afraid that i will need more base Bitrix and base php skills now. Because i was on interview and most our sites running on Bitrix and rare on WordPress. I was asked if i know UMI CMS, if i know Bitrix etc. But i want to be close to javascript. Oh, it's hard decision:)) I have only one head and only 24 hours a day)) I know only one thing. I don't want to be a freelancer, cause i search for sites more hours then working.

Edited by fleur

  • Author

I'd also say to learn frameworks that you would be excited to use, and not just ones used by loads of people. For me, React solves a lot of issues that I've had with UI, so it's a logical next step. It's something I can see working well for me. Angular on the other hand doesn't offer much that I need, apart from MVC organised code, but there are plenty of frameworks that have adopted that.

 

Another framework I'm also interested in is Meteor. You can create server-side and client-side apps using the same syntax, extremely fast. It looks like a great framework to start building some side projects, so it ticks the box there.

 

No one over here uses React, and I only know one company using Meteor, but programming for me is as much of a hobby as it is a career, so sometimes I want to learn something that doesn't necessarily have job benefits (over here at least), but will keep me focused and interested in what I'm doing. You can't learn something properly if you have no interest in the subject, and it all benefits you in the long run.

 

That said, my focus is primarily on fundamentals and getting vanilla JS projects out there. I've put frameworks completely to one side for now, but the appeal of them gives me enough drive to want to understand the core language. I'll get there eventually, and React might not even be the thing to use then, but I should have enough of a grasp of the language to pick up whatever's in motion then.

 

If the agency you work at uses something different, that's fine, mine does too. We're not a pure JS shop here by a long stretch. However, that doesn't stop me learning what I want outside of the office, applying it to my work, or even just as an investment for the future.

I'd also say to learn frameworks that you would be excited to use, and not just ones used by loads of people. For me, React solves a lot of issues that I've had with UI, so it's a logical next step. It's something I can see working well for me. Angular on the other hand doesn't offer much that I need, apart from MVC organised code, but there are plenty of frameworks that have adopted that.

 

Another framework I'm also interested in is Meteor. You can create server-side and client-side apps using the same syntax, extremely fast. It looks like a great framework to start building some side projects, so it ticks the box there.

 

No one over here uses React, and I only know one company using Meteor, but programming for me is as much of a hobby as it is a career, so sometimes I want to learn something that doesn't necessarily have job benefits (over here at least), but will keep me focused and interested in what I'm doing. You can't learn something properly if you have no interest in the subject, and it all benefits you in the long run.

 

That said, my focus is primarily on fundamentals and getting vanilla JS projects out there. I've put frameworks completely to one side for now, but the appeal of them gives me enough drive to want to understand the core language. I'll get there eventually, and React might not even be the thing to use then, but I should have enough of a grasp of the language to pick up whatever's in motion then.

 

If the agency you work at uses something different, that's fine, mine does too. We're not a pure JS shop here by a long stretch. However, that doesn't stop me learning what I want outside of the office, applying it to my work, or even just as an investment for the future.

 

 

Good advice, indeed! Thank you! :) And i agree this rbrtsmith advice too, that frameworks only need for "more app type projects". It's true. I discussed with a few owners about this and the say, that in my city the most used the combination:

 

- mongodb, express, angularjs, nodejs;

- Angular JS, RESTfull, web services, Json.

 

In internet i saw the article where author said about contribute to some project as junior js dev. When i will have enough js skills and enough free time, maybe i will think about it.

  • Author

 

Good advice, indeed! Thank you! :) And i agree this rbrtsmith advice too, that frameworks only need for "more app type projects". It's true. I discussed with a few owners about this and the say, that in my city the most used the combination:

 

- mongodb, express, angularjs, nodejs;

- Angular JS, RESTfull, web services, Json.

 

In internet i saw the article where author said about contribute to some project as junior js dev. When i will have enough js skills and enough free time, maybe i will think about it.

 

Have you considered going to a JS meetup? There must be some around your area. We don't have a JS specific ones over here, but I did go to a lot of general web dev meet ups, and it helped massively to get to know the other developers where I'm based. I speak to a lot of them often now. Not only does it help understanding what technologies people are using, it's beneficial if you're looking for work, or even help with learning something. You're more likely to get hired somewhere if you know, and get on with the team already. Culture fit is a big part of working in an agency or startup.

 

http://www.meetup.com/find/?allMeetups=false&keywords=javascript&radius=25&userFreeform=Moscow%2C+Russia&mcId=c1036267&sort=default

 

This isn't far off how Mattias describes getting his job at Spotify http://www.quora.com/How-can-I-get-a-job-at-Spotify.

 

Have you considered going to a JS meetup? There must be some around your area. We don't have a JS specific ones over here, but I did go to a lot of general web dev meet ups, and it helped massively to get to know the other developers where I'm based. I speak to a lot of them often now. Not only does it help understanding what technologies people are using, it's beneficial if you're looking for work, or even help with learning something. You're more likely to get hired somewhere if you know, and get on with the team already. Culture fit is a big part of working in an agency or startup.

 

http://www.meetup.com/find/?allMeetups=false&keywords=javascript&radius=25&userFreeform=Moscow%2C+Russia&mcId=c1036267&sort=default

 

This isn't far off how Mattias describes getting his job at Spotify http://www.quora.com/How-can-I-get-a-job-at-Spotify.

 

That Mattais is really inspirational, I need to get to more coder meetups myself..

 

Have you considered going to a JS meetup? There must be some around your area. We don't have a JS specific ones over here, but I did go to a lot of general web dev meet ups, and it helped massively to get to know the other developers where I'm based. I speak to a lot of them often now. Not only does it help understanding what technologies people are using, it's beneficial if you're looking for work, or even help with learning something. You're more likely to get hired somewhere if you know, and get on with the team already. Culture fit is a big part of working in an agency or startup.

 

http://www.meetup.com/find/?allMeetups=false&keywords=javascript&radius=25&userFreeform=Moscow%2C+Russia&mcId=c1036267&sort=default

 

This isn't far off how Mattias describes getting his job at Spotify http://www.quora.com/How-can-I-get-a-job-at-Spotify.

 

I was join local js meetup recently. I am going to learn more about can.js from this meetup. It's often used library in our companies. And thank you again for great advice and article!:) Mattias said: "In fact, the people I met at these events made me feel like I've come home." It's the most important thing! Actually Mattias was very lucky, because companies prefer to give tests in the office and 30min, not whole weekend at home:) it's important to see that people in the company like you. Because you can make test in home and then go for interview and from first second you will see that you can't fit in this team. And understood that you spent time for nothing with test. That's why Mattias is very wisdom guy. He made friendship before interview.:)

Those interested in some TDD basics I found a good screencast over on CodeSchool, they use the Mocha test framework with Chai assertion library + a few others. check it out: https://www.codeschool.com/screencasts/build-podcast-mocha

 

Thank you again for awesome article!

 

I have some question:

 

- when you declare function why you use name of the function and save function in var at the same time. maybe you do this for to have ability to make recursion in the future?

 

- you told that value of "this" in ES6 is different from ES5. I see that in first example "this" will get the value undefined. How will act rest code of the article in ES6?

 

I was playing with you code. It's easy to get result, using ES6 spread operator and rest parameter. I also put the example with "apply".

 

DEMO

Edited by fleur

 

Thank you again for awesome article!

 

I have some question:

 

- when you declare function why you use name of the function and save function in var at the same time. maybe you do this for to have ability to make recursion in the future? -- This is so you can see what function is in the stack trace in Chrome dev tools - when you do var foo = function() it is an anonymous function expression. Doing var foo = function foo() is a named function expression. The latter is preferable for debugging, and yes will allow for recursion in things like IIFE's

 

- you told that value of "this" in ES6 is different from ES5. I see that in first example "this" will get the value undefined. How will act rest code of the article in ES6?

'This' is only different when you're using arrow functions, it's bound to undefined in the examples you see here http://bit.ly/1Pgl9h9. However I've seen it behave differently on asynchronous code like click handlers. I need to do more research here before I can give a definitive answer. For now just don't use arrow functions if you're gonna reference 'this' inside of them. Arrows are not a direct replacement for normal functions.

 

I was playing with you code. It's easy to get result, using ES6 spread operator and rest parameter. I also put the example with "apply".

Easy to get what result? Spread and rest have nothing to do with 'this' binding.

 

DEMO

Edited by rbrtsmith

Thank you! I mean, spread and rest useful for arguments. I passes test recently with spread and rest and tried to use it again. It's userful for many cases and i try to learn it also. Agree that this behave differently on asynchronous code like click handlers. I saw many articles about it, but couldn't find the clear explanation. If you will consider to put some addition about it in your article it will be awesome!

In ES5 this in click handlers will reference the object that the click handler is bound to, it follows rule2 - method invocation. Nothing weird there. It's only on ES6 arrows that 'this' does not match those rules.

 

Rest and spread are very useful as are many ES6 features, but they're not the subject of my post, it might confuse people if we're changing subject mid post :)

Thank you! No, of cause, subject of post can't be changed, it's only for my learn goals. I start learn ES6 from this. And will learn let after this. I see that i need to play with "this" and arguments within event handlers (I mean click etc) and AddEventListener one more time and do some research. I tried two times but couldn't wrap my head around this theme. I mean, I understand that click handlers will reference the object that the click handler is bound to, but when i tried to pass value of "this" within the object methods with event handlers or different functions with event handlers i always receive error.

Edited by fleur

Let is a LOT simpler to learn than this. It's exactly the same as var except it respects block scope. Const is the more powerful as it is immutable, although you won't always want immutability in which case you would use let or var.

Thank you! I see. I saved this information for future learning. Maybe you can put a small example with "this" and event handlers at the end of your articles. Cause i see many questions on stackoverflow about this, but non of them don't have good answer and it is still "dark place" in many cases:)

Thank you! I see. I saved this information for future learning. Maybe you can put a small example with "this" and event handlers at the end of your articles. Cause i see many questions on stackoverflow about this, but non of them don't have good answer and it is still "dark place" in many cases:)

 

As I said earlier 'this' will follow rule2 - method invocation when used inside of event handlers, there's no need to put it as an example if you follow the rules you will see that it will equal the object the function is called upon. And if you use hard binding (rule 3 pt2) then that would override rule 2.

 

If you want more in depth explanations on this binding (or anything JS) check out Kyle simpsons you don't know JS series.

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.