Friday, November 23, 2018

The State of JavaScript 2018

#413 — November 23, 2018

Read on the Web

JavaScript Weekly

The State of JavaScript 2018 — The results of this popular annual survey are out now. React is the clear, dominant front-end framework of choice. Jest and Mocha are neck and neck in the testing space, and Python is the most common other language for JS developers to use.

Sacha Greif

Hyperscript Tagged Markup: A JSX Alternative using Standard Tagged Templates — A clever idea, this. It’s JSX-style syntax but in plain JavaScript (using tagged templates) that requires no special transpilation but still supports things like rest spread and referencing components.

Jason Miller

Create a Serverless Powered API in 10 Minutes — Use Cloudflare Workers to create and deploy a serverless API to 150+ data centers.

Cloudflare Workers sponsor

Experimenting with Brain-Computer Interfaces in JavaScript — Can you use JavaScript to analyze your brain? Yep. It’s fascinating to see the domains JS can be used with. I did something similar with an ECG (heart monitor) recently.

Charlie Gerard

WebSockets: A Conceptual Deep-Dive — An extensive look at the world of WebSockets, the browser technology that can provide a fast, full-duplex persistent connection between a server and client.

Ably

CMS.js: A Client-Side JavaScript Site Generator — A Markdown-oriented site generator in the spirit of Jekyll but with no server-side scripting at all (it simply fetches Markdown from your site and dynamically renders it).

Chris Diana

Google to Pay Frameworks to Implement 'Performance-First' Code — Google is launching a $200K fund to sponsor performance-focused development on third-party JavaScript frameworks.

ZDNet

💻 Jobs

Sr. Angular Engineer at Services/Product Firm (Toronto /Remote) — Do you love Angular and helping teams build products? Join forces with thought-leaders and Fortune 500 teams. Code, teach, speak.

NRWL.IO

Lead Front-End Developer with a Passion for UX (Remote) — Lead our front-end efforts, create tactful and experience-enhancing animations, and ultimately impact the way people learn design.

The Interaction Design Foundation

Join Our Career Marketplace & Get Matched With A Job You Love — Through Hired, software engineers have transparency into salary offers, competing opportunities, and job details.

Hired

📘 Tutorials and Opinions

Building an Interactive Infographic with Vue.js — A thorough guide to building a dynamic and interactive infographic using Vue.js, SVG and GreenSock (for animation).

Krutie Patel

Tackling UI Complexity with State Machines

Carlos Galarza

Transducers: Efficient Data Processing Pipelines in JavaScript — The latest in Eric’s series on functional programming techniques in ES6+.

Eric Elliott

Read Now: The Ultimate Guide To npm — Everything you need to know to know to use the npm CLI, from basic building blocks to time-saving tips and tricks.

NodeSource sponsor

Transpiling and Publishing ES2018 npm Modules with Babel 7 — How to use the latest and greatest JavaScript features but still ensure your packages can be used by as wide an audience as possible.

Sean van Mulligen

Creating iOS 12 Shortcuts with JS and Shortcuts JSGitHub repo.

Josh Farrant

Building Your Own Interactive JavaScript Playground — Not something many of us might think we want to do, but it’s interesting to see how we could replicate the underlying functionality of sites like JSBin or Code like CodeSandbox or CodePen if we wanted to.

Krasimir Tsonev

Dart for JavaScript Programmers — Possibly helpful advice if you want to work with Google’s Flutter mobile dev framework.

Hillel Coren

Using Azure Functions and the Marvel API to Visualize Character History — A nice collision of the worlds of Marvel, serverless, and JavaScript.

Raymond Camden

How Do Top Developers Deliver Video? - Download the 2018 Video Report

Bitmovin sponsor

How JSX is a Stellar Invention, Even with React Out of The Picture

Daniel Brain (PayPal)

💬 A Q&A with… Valeri Karpov
JavaScript book author and trainer
Miami Beach, Florida

Valeri, also known as The Code Barbarian, is a prolific author of JavaScript tutorials and books and was also the person to coin the term MEAN (as in the MongoDB, Express.js, Angular and Node.js stack). To celebrate the release of his new book, Mastering Async/Await, we've asked him a few questions:

You're a very prolific JavaScript blogger - what's your secret?

I don't have any special secret, I've made a personal commitment to writing regularly because I find it helps me refine my ideas. I spend a lot of time coding, and I write as a way to identify general principles from the day-to-day of finding bugs and adding features. Writing gives me a great excuse to try out new libraries or frameworks.

Have you seen any ways in which async/await are overused or misused that people should avoid?

The most glaring issue is using async/await with a framework without looking to see if the framework actually supports it! There's probably a lot of developers out there wondering why their async Express route handler isn't sending a response or why their React component's async componentDidMount function isn't working with server-side rendering.

I also see a surprising amount of code that uses async/await mixed with classic callbacks or promise chains. While passing an async function to a promise's then() function as shown below is valid, it misses the point of async/await:

What resources should our readers check out to learn more about async/await?

  • I'm a fan of the JavaScript.info tutorial. If you've never seen async/await before and just want to start tinkering with it, this is the resource I'd recommend.
  • When I first started working with co and generators, it took me a while to get out of my own way and be comfortable writing loops instead of reaching for libraries like async. My article on async/await design patterns has some more advanced examples of using async/await with loops.
  • The Pony Foo article on async/await is also excellent. While it's an older article now, it does a great job explaining how code that uses async/await is every bit as asynchronous and non-blocking as callback-based code.

Valeri Karpov is the author of Mastering Async/Await — out now.

🔧 Code and Tools

Demoboard: A Live Code/Demo Editor That Integrates with npm

James K Nelson

create-yo: Use Any Yeoman Generator with npm init

Christopher Hiller

Black Friday Sale: Quokka.js - Debug Without breakpoints/console.log — Quokka displays execution results in your editor as you type. Get it now with a 50% discount.

Wallaby.js sponsor

Nivo: D3.js-Powered React Data Visualization Components — Examples and code on the official homepage.

Raphaël Benitte

D3Funnel: A JavaScript Library for Rendering Funnel Charts using D3.js

Jake Zatecky

Awesome Angular GraphQL: A Curated Collection of Resources, Clients and Tools

Hasura

🗓 Upcoming JavaScript Events


by via JavaScript Weekly

Quick Tip: How to Sort an Array of Objects in JavaScript

Sort an array of objects in JavaScript

If you have an array of objects that you need to sort into a certain order, the temptation might be to reach for a JavaScript library. Before you do however, rember that you can do some pretty neat sorting with the native Array.sort function. In this article I'll show you how to sort an array of objects in JavaScript with no fuss or bother.

To follow along with this article, you will need a knowledge of basic JavaScript concepts, such as declaring variables, writing functions, and conditional statements. I'll also be using ES6 syntax. You can get a refresher on that here: https://www.sitepoint.com/tag/es6/

Basic Array Sorting

By default, the JavaScript Array.sort function converts each element in the array to be sorted, into a string, and compares them in Unicode code point order.

const foo = [9, 2, 3, 'random', 'panda'];
foo.sort(); // returns [ 2, 3, 9, 'panda', 'random' ]

const bar = [4, 19, 30, function(){}, {key: 'value'}];
bar.sort(); // returns [ 19, 30, 4, { key: 'value' }, [Function] ]

You may be wondering why 30 comes before 4… not logical huh? Well, actually it is. This happens because each element in the array is first converted to a string, and "30" comes before "4" in Unicode order.

It is also worth noting that unlike many other JavaScript array functions, Array.sort actually changes, or mutates the array it sorts.

const baz = ['hello world', 31, 5, 9, 12];
baz.sort(); // baz array is modified
console.log(baz); // shows [12, 31, 5, 9, "hello world"]

To avoid this, you can create a new instance of the array to be sorted and modify that instead.

const baz = ['hello world', 31, 5, 9, 12];
const newBaz = baz.slice().sort(); // new instance of baz array is created and sorted
console.log(baz); // "hello world", 31, 5, 9, 12]
console.log(newBaz); // [12, 31, 5, 9, "hello world"]

Try it out

JS Bin on jsbin.com

Using Array.sort alone would not be very useful for sorting an array of objects, thankfully the function takes an optional compareFunction parameter which causes the array elements to be sorted according to the return value of the compare function.

The post Quick Tip: How to Sort an Array of Objects in JavaScript appeared first on SitePoint.


by Olayinka Omole via SitePoint

Coming soon: Facebook to introduce dark mode for Messenger users

By now everyone is aware of the harmful effect that light from a smartphone screen can have on you. Simply put, it messes up your sleep cycle. Following the spread of this information there was a whole slew of new apps and features that are supposedly meant to curb the impact of this harsh light....

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Zia Zaidi via Digital Information World

Target CSS for Specific Content With WordPress Template Tags

Italic

What a fresh design in this launching soon page for Italic – a startup that sources products straight from the manufacturers of top brands. Note the slick waitlist sign up box animation as you scroll and also nice touch with the ‘Call Our CEO’ link in the Footer.

Full Review | Direct Link


by Rob Hope @robhope via One Page Love

Daniel Spatzek Portfolio 2018

2018 portfolio of Graphic Designer, Developer and Art Director Daniel Spatzek.
by via Awwwards - Sites of the day

Facebook launches a new tool that will let you know how much time you've spent on the social network

As we have already heard that Facebook is expecting to launch a new tool that will inform the users about how much time he or she has spent on Facebook. Though the feature was expected to be launch earlier than now. However, Facebook justifies it by saying that it's rolling out this feature slowly...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Amjad Khan via Digital Information World