This Week in JavaScript - 15 November 2015

Hello and welcome to ‘This Week in JavaScript’ — another curated collection of links relating to what’s new and exciting in the world of JavaScript. The complete list is tagged jsweekly. (Don’t forget to check out our weekly .NET and front end roundups too!)

And now for this week’s finds …


Getting started

Learning more

ES6

##ES7

  • What’s in ECMAScript 2016 (ES7)? - Dr. Axel Rauschmayer describes the details of the new release process, along with four features that will probably be in ECMAScript 2016.

##ReactJS

Libraries

Frameworks


For more links like this and to keep up-to-date with the latest goings on in JS land, you can follow SitePoint’s JavaScript channel on Twitter.
Please PM us if you have anything of interest for the next issue or if there is anything you would like to see featured. Paul and Chris of Arabia.

1 Like

Thanks Chris. That tic-tac-toe one certainly needs some AI improvement. Anyone like seeing how they can improve on how it plays?

Recently I also came across Mancala, also known of as Kalah and Oware, where you have a 2x6 row of pots. It’s a sowing game, that looks simple but has some rather deep strategy elements to it.

I only played tic tac toe a few times, but it did feel a little basic - a fun throwaway for the newsletter though.

With the assignment operators piece, there is more to it than what appears on the surface. For example: with:

a = b = c;

Where they say:

It doesn’t quite work in that way. Yes, a equals the result of b, but that assignment is delayed until after b has been assigned. The first one to be assigned is b which gets the value of c, but you have to be very careful because if b doesn’t yet exist, it will be made a global variable as window.b

Only after that is assigned the result of b.

So in effect, if you have the following code:

var a = b = c;

What is really happening instead is:

b = c;
var a = b;

And if that’s really how you want to assign your values, it’s best to write it as such to avoid confusion and bugs later on down the road.

I think that chaining assignments leads to problems when developers misunderstand what they’re looking at, and is best to be avoided in preference for clearer code that is less likely to be misunderstood.

1 Like

In the back of my head, I think I knew that, but it’s definitely something that’s worth clarifying - especially for those quite new to JS (which includes me). I wonder how many people your example has caught out over the years?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.