Viewing a response to: @boyanpro/let-s-get-back-to-basics-javascript
Iono man, let & const should be used when use strict is on... Right?
post_id | 75,098,251 |
---|---|
author | sn0n |
permlink | re-boyanpro-let-s-get-back-to-basics-javascript-20190521t113403861z |
category | programming |
json_metadata | {"tags":["programming"],"app":"steempeak\/1.9.9"} |
created | 2019-05-21 11:34:06 |
last_update | 2019-05-21 11:34:06 |
depth | 1 |
children | 1 |
net_rshares | 28,569,317,528 |
last_payout | 2019-05-28 11:34:06 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 69 |
author_reputation | 8,066,156,921,766 |
root_title | "Let's get back to basics - JavaScript" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
boyanpro | 0 | 28,569,317,528 | 100% |
Not necessarily. While `"use strict"` came in ES5 and `let`+`const` came later with ES6 what is worth remembering is that `var`, `let` and `const` have different features and that then means different usages. `let` and `const` don't make `var` obsolete, they make it less powerful. Here are more details about `const`, `let` and `var`: - `const` is a signal that the identifier wonโt be reassigned. - `let`, is a signal that the variable may be reassigned, such as a counter in a loop, or a value swap in an algorithm. It also signals that the variable will be used only in the block itโs defined in, which is not always the entire containing function. - `var` is now the weakest signal available when you define a variable in JavaScript. The variable may or may not be reassigned, and the variable may or may not be used for an entire function, or just for the purpose of a block or loop. In other words here are differences between these three: - `var` declarations are globally scoped or function scoped while `let` and `const` are block scoped. - `var` variables can be updated and re-declared within its scope; `let` variables can be updated but not re-declared; `const` variables can neither be updated nor re-declared. - They are all hoisted to the top of their scope but while `var` variables are initialized with undefined, `let` and `const` variables are not initialized. - While `var` and `let` can be declared without being initialized, `const` must be initialized during declaration. Here are w3schools page explaining "use strict": https://www.w3schools.com/js/js_strict.asp I hope my explanation was helpful. Cheers!
post_id | 75,105,274 |
---|---|
author | boyanpro |
permlink | re-sn0n-re-boyanpro-let-s-get-back-to-basics-javascript-20190521t142230067z |
category | programming |
json_metadata | {"tags":["programming"],"app":"steempeak\/1.9.9"} |
created | 2019-05-21 14:22:30 |
last_update | 2019-05-21 14:22:30 |
depth | 2 |
children | 0 |
net_rshares | 28,066,126,626 |
last_payout | 2019-05-28 14:22:30 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 1,641 |
author_reputation | 1,773,735,625,367 |
root_title | "Let's get back to basics - JavaScript" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
boyanpro | 0 | 28,066,126,626 | 100% |