r/javascript • • Nov 01 '18

JavaScript is now required to sign in to Google

Thumbnail
security.googleblog.com
324 Upvotes

r/javascript • • Jul 29 '16

The Inner JSON Effect

Thumbnail
thedailywtf.com
324 Upvotes

r/javascript • • Jun 03 '21

yare.io - practice your JavaScript skills by playing a real-time strategy game

Thumbnail
yare.io
323 Upvotes

r/javascript • • Feb 22 '20

Top Free Programming Books for Front-End Developers

Thumbnail
booksoncode.com
323 Upvotes

r/javascript • • Oct 08 '19

πŸš€ Top-level await makes it possible to use the `await` keyword outside of async functions in JavaScript modules!

Thumbnail
v8.dev
323 Upvotes

r/javascript • • Feb 26 '16

"I'm closing down Express 5.0"

Thumbnail
github.com
323 Upvotes

r/javascript • • Dec 04 '20

No One Ever Got Fired for Choosing React

Thumbnail
jake.nyc
322 Upvotes

r/javascript • • Apr 15 '20

Crank.js - An alternative to React.js with built in support for promises and generator functions for state.

Thumbnail
github.com
322 Upvotes

r/javascript • • Feb 14 '20

Listen to your web pages render with DOM Mutation Observer and Web Audio API

Thumbnail
gist.github.com
322 Upvotes

r/javascript • • Sep 13 '19

Infinite Missiles - a Missle Defender game in 13kb of JavaScript

Thumbnail
js13kgames.com
322 Upvotes

r/javascript • • Sep 29 '18

help One of the devs that does code review for my code keeps bringing this style note up, which I personally disagree with. Opinions?

322 Upvotes

This is just a simplified version, as an example

My code:

function foo() {
   if (bar) {
      // logic
      return something;
   } else {
      return somethingElse;
   }
}

His refactor:

function foo() {
   if (bar) {
      // logic
      return something;
   }
   return somethingElse;
}

Which do you prefer?

I personally find the first to be more readable. Thoughts?


r/javascript • • Mar 20 '18

Excited that OffscreenCanvas is finally happening: <canvas> that's usable in a worker 🀘Behind a flag in Chrome 60 and FF 44.

Thumbnail
twitter.com
322 Upvotes

r/javascript • • Jan 02 '22

Since we weren't able to go to a fireworks display in person, I made one with JavaScript and the HTML5 canvas. Enjoy, and Happy New Year to all y'all programmers out there!

Thumbnail codepen.io
321 Upvotes

r/javascript • • Jun 02 '21

AskJS [AskJS] why are arrow functions used so universally nowdays? What's the benefit over named functions/function keyword?

321 Upvotes

This really interested me particularly in the React ecosystem. A lot of times I see something like this:

const UserList = (props: Props) => {}
export default UserList;

I've never really understood this: why would you use a `const` here and an arrow function when you can just use the function keyword and make it far more concise? I would say it's even easier to understand and read

export default function UserList(props: Props) {}

Maybe I'm an old fart but I remember the arrow function being introduced basically for two primary purposes:

  1. lambda-like inline functions (similar to python)

  2. maintaining an outer scope of this

for the lambda function, it's basically just replicating python so you don't have to write out an entire function body for a simple return:

// before arrow function, tedious to write out and hard to format
users.map(function (user) {
  return user.id;
})
// after, quick to read and easy to understand
users.map(user => user.id);

the other way I've really seen it apply is when you need `this` to reference the outer scope. For example:

function Dialog(btn: HTMLButtonElement) {
  this._target = btn;
  this._container = document.createElement('dialog');
}

Dialog.prototype.setup = function setup() {
  this._target.addEventListener('click', () => {
    this._container.open = !this._container.open;
  });
}

// Gotta use the `const self = this` if you wanna use a normal function
// Without an arrow function, it looks like this:
Dialog.prototype.setup = function setup() {
  const self = this;
  self._target.addEventListener('click', function () {
    self._container.open = !self._container.open;
  });
}

but in the case I showed above, I see it everywhere in react to use constants to store functions, but I don't totally understand what the inherent benefit is past maybe some consistency. The only other one I've found is that if you're using typescript, you can more easily apply types to a constant.

So is there some reason I am not aware of to prefer constants and avoid the function keyword?


r/javascript • • Mar 08 '19

How I ruined my JavaScript code and still won the Coding Challenge

Thumbnail
tsh.io
321 Upvotes

r/javascript • • Dec 11 '18

A Recap of Frontend Development in 2018

Thumbnail
medium.com
321 Upvotes

r/javascript • • Mar 16 '18

Ryan Dahl, the creator of Node.js, will be giving a talk on Propel, a JS machine learning framework, at JSConf EU

Thumbnail
2018.jsconf.eu
321 Upvotes

r/javascript • • Feb 20 '18

Optional Chaining may be coming to JavaScript

Thumbnail
dev.to
321 Upvotes

r/javascript • • Nov 16 '17

JavaScript. The Core: 2nd Edition

Thumbnail
dmitrysoshnikov.com
321 Upvotes

r/javascript • • Nov 03 '16

Vue.js is the most trending framework of github. 117 stars per day

Thumbnail bestof.js.org
321 Upvotes

r/javascript • • Dec 27 '18

help What differences do you see in novice javascript code vs professional javascript code?

320 Upvotes

I can code things using Javascript, but the more I learn about the language, the more I feel I'm not using it properly. This was especially made apparent after I watched Douglas Crockford's lecture "Javascript: The good parts." I want to take my abilities to the next level, but I'm not really sure where to start, so I was hoping people could list things they constantly see programmers improperly do in JS and what they should be doing instead.. or things that they always see people get wrong in interviews. Most of the info I've learned came from w3schools, which gives a decent intro to the language, but doesn't really get into the details about the various traps the language has. If you have any good book recommendations, that would be appreciated as well.


r/javascript • • Feb 16 '17

The Google Analytics Setup I Use on Every Site I Build

Thumbnail
philipwalton.com
320 Upvotes

r/javascript • • Sep 06 '20

Learn the basics of Vanilla JS by building a Snake Game

Thumbnail
dev.to
319 Upvotes

r/javascript • • May 28 '20

Stack Overflow Developer Survey 2020: JS wins with 67.6%

Thumbnail
insights.stackoverflow.com
319 Upvotes