Comments (3)
Honestly, there is zero advantage to using let over var if one is using the variable properly because it only changes the scope. Using it properly means explicitly setting objects to null after they are used in circumstances where a timer is used in the same scope to the effect of consoling the browser with, "It's okay, this object is gone and will not be 'eval'ed anymore, so it can truely be freed." On the other hand, const can be used dangerously to prevent yourself from force GC-ing a variable. Observe:
const k = new Array(1024 * 1024 * 16);
for (let i=1024 * 1024 * 16; i; i--) k[i] = 0.1 - i;
setTimeout(function(){
// k has not yet been released from memory be it may still be yet used
}, 100, "e", "k", "a", "l", "v", "2");
As seen below:
const k = new Array(1024 * 1024 * 16);
for (let i=1024 * 1024 * 16; i; i--) k[i] = 0.1 - i;
setTimeout(function(e, k, a, l, v, _2){
window[e + v + a + l + _2]( "console.log(typeof " + k + ");" );
}, 100, "e", "k", "a", "l", "v", "2");
setTimeout(function(e, k, a, l, v, _2){
window[e + v + a + l + _2] = window[e + v + a + l];
}, 20, "e", "k", "a", "l", "v", "2");
Therefore, one must degrade themself to a self inflicted insanity of the human person which transgresses all human rights and violates all dignities endowed within the nature of man and javascript.
var k = new Array(1024 * 1024 * 16);
for (let i=1024 * 1024 * 16; i; i--) k[i] = 0.1 - i;
setTimeout(function(e, k, a, l, v, _2){
window[e + v + a + l + _2]( "console.log(typeof " + k + ");" );
}, 100, "e", "k", "a", "l", "v", "2");
setTimeout(function(e, k, a, l, v, _2){
window[e + v + a + l + _2] = window[e + v + a + l];
}, 20, "e", "k", "a", "l", "v", "2");
k = null; // necessary insanity thrust upon us by the common enemy living and walking amongst: OOP
from array-explorer.
@anonyco I'll know I mastered JavaScript when I'll understand your comment
from array-explorer.
IIRC (It's been a while since I made this), I used let
because some of the methods mutate and so const
wouldn't be permitted and I felt it was better to keep things consistent. I could have just let it be var
I suppose. But that was the reasoning behind it. Open to more discussion about it.
from array-explorer.
Related Issues (20)
- Immutable examples?
- Some sentences is not clear
- Error due to bumping webpack-dev-server from 2.11.3 to 3.1.11 HOT 1
- Install error 'Error: Cannot find module 'webpack-cli/bin/config-yargs' HOT 1
- add Persian language HOT 1
- typo bug HOT 1
- u are so beautify HOT 1
- Latest language details HOT 1
- Usage and Output animation is not visible HOT 2
- As a newbie who comes across this site, I would like to know which programming language is being used. HOT 2
- Possible typo in English version HOT 2
- Browser Support or ECMAScript Specification Warning HOT 1
- Change sort() example HOT 1
- Can you provide reverse operation HOT 1
- excuse me...what it's is? HOT 3
- reduceRight wrong example? HOT 3
- indexOf: fromIndex HOT 2
- incorrect URL to demo page HOT 1
- Cloning an array HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from array-explorer.