Sign in to follow this  

Learning Javascript after C++

This topic is 818 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey there,

 

Some time ago I started programming in C++ to learn the basics of programming.

Now, I know those basics (exactly: variables, conditional statements, loops, functions, pointers, arrays, vectors, classes, inheritance, dynamic memory, I'm learning about template programming now and will learn some other topics in the near future)

 

Now, I decided that I want to learn about web development. After some reasearch, I found out that Javascript would

probably be a good choice for that.

 

Now I have three questions:

The first and most important one: what are good resources (the best would be a book) to learn javascript for someone who already knows the basic concepts of programming.

The second: Is javascript and web development hard to learn if you know the basics of C++

The third, more an opinion question: Do you think Javascript is a good choice for me, if not: what would you choose?

 

I hope everything is clear, otherwise I would be glad to hear it,

in order to clarify some things.

 

Thanks in advance.

Share this post


Link to post
Share on other sites

So far the three things I've learned from JavaScript are:

 

1. Everything is a key-value structure.

2. There are only 64 bit floats. Nothing else.

3. Semi colons aren't mandatory.

 

That means three things (in order):

 

1. You can add attributes to a function or more functions to a function, or functions to an attribute, or anything really. Pretty fun.

2. Math is costly. VMs can do optimistic typing for some stuff but its not magical.

3. Not using semi colons will bite you in the butt someday.

 

That's all I've learned from it.

 

Also I've read good recommendations about JavaScript: The Definitive Guide. It doesn't deals with ECMAScript 6 (aka 'let', 'const' and classes), but beyond that, it has everything covered it seems.

Share this post


Link to post
Share on other sites

I suggest Codewars.com and Eloquent Javascript if you're wanting to learn Javascript. And if you know the basics as you have described, then you'll be in good shape.

 

Oh as anyone who has really programmed in Javascript will tell you, be prepared to learn some functional programming. Javascript does use it quite a bit.

Edited by Alpha_ProgDes

Share this post


Link to post
Share on other sites

Yes and no. I was originally a C++ dev and ended up spending a lot of time looking at Java, JS and Python systems.

 

A lot of Javascript will feel familiar, just with different syntax. Some of it is even quite nice -- proper anonymous instances so you don't have to define a whole class and an instance just to pass it to a function.

 

On the other hand, a lot of Javascript is flaky, slow, oddly expensive in places and sometimes just plain counter-intuitive (comparisons don't always do what you think they do[1]). To make things worse some stuff (event handling in particular) varies between browsers.

 

It's easier if you have a library around to help with some of this stuff (like abstracting away some of the browser-varying parts). jQuery is widely used, there's a lot written about it and it's relatively easy to understand as long you know enough html/css.

 

Second the recc for JavaScript: The Definitive and there's also http://bdcampbell.net/javascript/book/javascript_the_good_parts.pdf

 

 

 

[1] Unlike in C++, things get type converted before being compared if you use == and it leads to counterintuitive results.

Share this post


Link to post
Share on other sites

Yes and no. I was originally a C++ dev and ended up spending a lot of time looking at Java, JS and Python systems.

 

A lot of Javascript will feel familiar, just with different syntax. Some of it is even quite nice -- proper anonymous instances so you don't have to define a whole class and an instance just to pass it to a function.

 

On the other hand, a lot of Javascript is flaky, slow, oddly expensive in places and sometimes just plain counter-intuitive (comparisons don't always do what you think they do[1]). To make things worse some stuff (event handling in particular) varies between browsers.

 

It's easier if you have a library around to help with some of this stuff (like abstracting away some of the browser-varying parts). jQuery is widely used, there's a lot written about it and it's relatively easy to understand as long you know enough html/css.

 

Second the recc for JavaScript: The Definitive and there's also http://bdcampbell.net/javascript/book/javascript_the_good_parts.pdf

 

 

 

[1] Unlike in C++, things get type converted before being compared if you use == and it leads to counterintuitive results.

 

 

I am actually a huge fan of JavaScript: The Good Parts. It might be a bit dated but I think most of it still holds true (such as making it a point to never use '==' in favor of '==='). JavaScript Patterns is really good too. You can actually get plugins for most code editors that will lint you're code using the standards explained in "The Good Parts".

 

JavaScript is pretty much the language of the web and it does have it's really bad clunky parts to it but it has great things too. The biggest problem with web development is that you're working inside of a browser and generally you have to worry about supporting many different browsers which all have small (sometimes big) quirks that you have to learn to get around. Using libraries like jQuery, Underscore etc help a lot in that area.

 

There are some frameworks (nw.js, CEF etc...) that you can make applications using and you'd only have to focus on the browser tech that framework uses which can be really fun and very freeing if you're used to working in the browser.

Edited by DeFessler

Share this post


Link to post
Share on other sites

This topic is 818 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this