TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A Reintroduction to JavaScript

321 pointsby psibiover 11 years ago

16 comments

celloverover 11 years ago
I am currently in the process of re-learning JavaScript from scratch. And I found the light:<p>1. Douglas Crockford videos: <a href="http://www.yuiblog.com/crockford/" rel="nofollow">http:&#x2F;&#x2F;www.yuiblog.com&#x2F;crockford&#x2F;</a><p>2. Eloquent JavaScript intermediate level tutorials: <a href="http://eloquentjavascript.net/contents.html" rel="nofollow">http:&#x2F;&#x2F;eloquentjavascript.net&#x2F;contents.html</a>
评论 #7170600 未加载
评论 #7178063 未加载
评论 #7178619 未加载
评论 #7173003 未加载
henrywover 11 years ago
The &quot;even nicer [array for loop] idiom&quot; is pretty cool:<p><pre><code> for (var key = 0, value; value = someArray[key++];) { &#x2F;&#x2F; value is already defined by for loop console.log(&#x27;index: &#x27; + key, &#x27;value: &#x27; + value); } </code></pre> Also, I finally understand closures:<p>&quot;Whenever JavaScript executes a function, a &#x27;scope&#x27; object is created to hold the local variables created within that function. It is initialised with any variables passed in as function parameters. This is similar to the global object that all global variables and functions live in, but with a couple of important differences: firstly, a brand new scope object is created every time a function starts executing, and secondly, unlike the global object (which in browsers is accessible as window) these scope objects cannot be directly accessed from your JavaScript code... A closure is the combination of a function and the scope object in which it was created.&quot;
评论 #7174153 未加载
评论 #7173946 未加载
评论 #7173448 未加载
评论 #7176584 未加载
评论 #7178849 未加载
welderover 11 years ago
The example of JavaScript&#x27;s prototype here is the best I&#x27;ve ever seen! It&#x27;s in the &quot;Custom Objects&quot; section.
评论 #7170651 未加载
babuskovover 11 years ago
Since I started using JS heavily lately, it&#x27;s nice to be reminded of some things. Thanks for posting.<p>One question though, it says:<p><pre><code> If you want to append an item to an array, the safest way to do it is like this: a[a.length] = item; &#x2F;&#x2F; same as a.push(item); </code></pre> a.push() variant seems more elegant to me. Why is a[] variant &quot;safer&quot;?
评论 #7170311 未加载
评论 #7170460 未加载
aaronetzover 11 years ago
Off-topic, but I must say that this site handles resizing very well. I really appreciate it when a website seamlessly transitions from desktop-size to mobile-size layout. Sometimes I just like having my browser window shrunk down (or zoomed in for viewing from farther away), which means that with most sites I have to scroll horizontally, which is not very usable.
ritchieaover 11 years ago
It is probably a good idea to add 2006 to the title since that&#x27;s the date of the last update [1].<p>1. <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript#Original_Document_Information" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;JavaScript&#x2F;A_re...</a>
评论 #7169946 未加载
评论 #7169826 未加载
评论 #7169843 未加载
评论 #7169802 未加载
inglorover 11 years ago
Some mistakes there, will fix. `null` is most certainly not an object.
评论 #7169748 未加载
评论 #7169762 未加载
jokoonover 11 years ago
still a better introduction to javascript:<p><a href="https://www.destroyallsoftware.com/talks/wat" rel="nofollow">https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;wat</a><p>(with a little bit of ruby)
评论 #7170473 未加载
almogover 11 years ago
&quot;We&#x27;ve introduced another keyword: &#x27;new&#x27;. new is strongly related to &#x27;this&#x27;. What it does is it creates a brand new empty object, and then calls the function specified, with &#x27;this&#x27; set to that new object&quot;<p>Perhaps it would be worth to mention that &#x27;new&#x27; not only sets &#x27;this&#x27; to be the empty object but also return that object to the location where new was used.
brofserover 11 years ago
I&#x27;ve read this article a couple of times in the last few years and it never ceases to amaze me. Clearly and in a concise way it lists all the points that people usually miss about JS.
shultaysover 11 years ago
&quot;if you&#x27;re used to math in C or Java. Watch out for stuff like: 0.1 + 0.2 == 0.30000000000000004&quot;<p>Uh, how floating poing operators are different than this in C or java
mr-ronover 11 years ago
One of my favorite tutorials from John Resig: <a href="http://ejohn.org/apps/learn/" rel="nofollow">http:&#x2F;&#x2F;ejohn.org&#x2F;apps&#x2F;learn&#x2F;</a>
andrethegiantover 11 years ago
I didn&#x27;t know about the memory leak stuff! Any tools out there to help identify this in your code?
评论 #7172516 未加载
shaboonover 11 years ago
if that&#x27;s was it&#x27;s first name it should be renamed back to LiveScript
评论 #7175619 未加载
评论 #7177137 未加载
tunnuzover 11 years ago
Old but gold.
CmonDevover 11 years ago
If you wanted to find a friend for someone would you keep trying to introduce them to same stupid ugly person, while saying: &quot;Look! He&#x2F;she is wearing make-up this time!&quot;.
评论 #7169654 未加载
评论 #7170206 未加载
评论 #7183983 未加载
评论 #7169749 未加载