- JavaScript is a loosely typed language which means it doesn’t care type too much. Most times, it can convert different types automatically for us. But sometimes, you may actually need to know the exact type of a variable. And you may have trouble to do that in JS…
(We will only focus on normal types, a lot new types in...
TaoAlphatechjstype check Sa, August 27, 201616 minutes to read - Deep Copy vs Reference CopyIn javascript, everytime you use = or pass a primitive to a function, you are doing deep copy, since whatever happends to it will never affect the origin one.
But things will be so different on objects:
123456789101112131415161718192021// deep copy on primitiveslet a = "hello";let b = a;b = 1...
TaoAlphatechjscopy Sa, August 13, 20168 minutes to read - HistoryLike brianleroux said in his post ES6 Modules: The End of Civilization As We Know It?: “For many years JS had a single widely accepted module format, which is to say, there was none. Everything was a global variable petulantly hanging off the window object.”
Before we have CommonJS, AMD and the newest ES6 module...
TaoAlphatechjsmodule Fr, June 17, 20169 minutes to read - Write AheadAbout 30 minutes ago, I tried to rewrite the colors module, at least part of it :). Then I found a nice and rarely used method defineProperty which made the past 30 minutes totally worth it.
Rewrite the colorsBefore we put our hands on defineProperty, I want to tell you how I found this method :) colors is a...
TaoAlphatechjs Fr, April 29, 20167 minutes to read - Write AheadES6 introduces a new primitive type into JavaScript which is Symbol. All symbols are unique so you can treat them as tokens server as unique id.
You can create a symbol using its factory function Symbol(), you can pass a parameter to it as the name of the symbol, but most of time, the name is only used to de...
TaoAlphatechjses6symbol Th, April 28, 20169 minutes to read - StoryYesterday, I got a question from a friend who asked me to review his code and explain why the object he printed out got changed before he actually modifies it. This is a classic ‘asynchronous’ or lazy evaluation(more accuarately) problem of console.log().
We all know that console.log is the most popular and common...
TaoAlphatechjs Th, April 21, 20167 minutes to read - Function.call and Function.apply are two very important methods and you should be very familiar with them if you are good at functional javascript. The most important and the only purpose of these two methods is to convert one input to another.
These two methods are easy to use but also easy to confuse, people always f...
TaoAlphatechjsapplycall Su, April 17, 20169 minutes to read - As I promised, I have been working on refactoring the feedpusher with pure JS/nodeJS from last week. Now I have set up the basic database struture and spider which has already been running for one week with 80 sites and 8k feeds stored into my mongodb on raspberry pi.
Today, I jsut set up a new process to crawl the upd...
TaoAlphatechjs Tu, January 12, 201612 minutes to read - Why and What is Coding StyleCoding style is like the common styles and patterns that are used in your personal codebase or some organizations’ codebase, its purpose is making your code more readable and reusable through the entire developemnt, especially when you work in a team. Everyone can create their own coding sty...
TaoAlphareadingsjscoding style Sa, January 9, 201648 minutes to read - Want to send an email in your static website without any server languages support? Seems impossible. But now you can do that using only JavaScript. Wonderful? I will show you how to do that.
Tools we need
Mandrill: they provide the mail service that you can call using javascript;
website: the website you want to do thi...
TaoAlphatechjsmandrillemail We, September 30, 20156 minutes to read