Skip to content

Added numeric separator for improve readability#283

Merged
ryanmcdermott merged 1 commit intoryanmcdermott:masterfrom
behnammodi:patch-1
Jan 19, 2020
Merged

Added numeric separator for improve readability#283
ryanmcdermott merged 1 commit intoryanmcdermott:masterfrom
behnammodi:patch-1

Conversation

@behnammodi
Copy link
Contributor

@behnammodi behnammodi commented Jan 18, 2020

const MILLISECONDS_IN_A_DAY = 86_400_000;

We can use numeric separator with
https://babeljs.io/docs/en/babel-plugin-proposal-numeric-separator

@behnammodi behnammodi changed the title Added number separator for improve readability Added numeric separator for improve readability Jan 18, 2020
@markgoho
Copy link

Is this native to JavaScript? I don't think we should be adding layers to this document that depend on third party libraries.

@behnammodi
Copy link
Contributor Author

@markgoho Yes, this is supported by new browser

@behnammodi
Copy link
Contributor Author

@markgoho If you want to sure about it you open chrome dev tools and try it

@markgoho
Copy link

@uxitten Indeed, browser support is high

However, browser support !== native Javascript. It appears the proposal is at Stage 3.

Ultimately, I don't think it's the goal of this repo to introduce new concepts (methods, syntax, grammar) in JavaScript. If the author wants to use ES5 for everything, they're welcome to. The goal of the repo is to show concepts of clean code and one can certainly achieve that without using every new bit of JavaScript that makes it into the browser.

@ryanmcdermott
Copy link
Owner

Hey there! 👋 I really love the numeric separator and your PR regarding it! Very handy for readability, and this project is emphatic on that being an essential facet for clean code.

Some history: This project started without a focus on any particular "dialect" of JS, insofar as new features constituted a dialect change. I fundamentally don't think the dialect really matters because in practice (based on Node's 2018 user survey as corroboration) ~70% of people use transpilers anyway. That number continues to grow.

All that to say.... I want this project to continue to be updated with better JS features, without explicitly making this guide about "use this wizbang new great JS feature". It's all about whatever represents the Clean Code concepts the best without trying to introduce any new concepts if possible. If that means a new feature, then so be it!

I'm going to merge this PR since it helps readability, and that's the end goal. Thanks for your work, please feel free to contribute even more if you ever have the chance!

@ryanmcdermott ryanmcdermott merged commit 0ff4aba into ryanmcdermott:master Jan 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants