In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
The main content of this article is to explain "what is CoffeeScript". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what CoffeeScript is.
CoffeeScript is a translation language for JavaScript, and its founder JeremyAshkenas jokingly calls it the less extravagant little brother of JavaScript. Because CoffeeScript compiles code similar to Ruby syntax into JavaScript, and most of the structures are similar, the difference is that CoffeeScript has a stricter syntax.
How's CoffeeScript?
CoffeeScript, like TypeScript, is a language compiled into JavaScript, and they enhance the expressive power of JavaScript. The so-called compile to JavaScript means that CoffeeScript and TypeScript do not implement their own runtime, they are compiled into equivalent JavaScript code, and then run on JavaScript's interpreter.
The biggest impression of CoffeeScript is its concise expression.
# assignment:
Number=42
Opposite=true
# conditions:
Number=-42ifopposite
# function:
Square= (x)-> xxxx
# Array:
List= [1,2,3,4,5]
# object:
Math=
Root:Math.sqrt
Square:square
Cube: (X)-> x*squarex
# Splats:
Race= (winner,runners...)->
Printwinner,runners
The conciseness of CoffeeScript
CoffeeScript strives for simplicity. Its conciseness is first shown in the removal of some symbols that are only used for grammar control. These include:
Cancel semicolon
Cancel the var statement
Unenclose the inner code in curly braces and use indentation instead
Function calls can omit parentheses without ambiguity
The var declaration involves the complex and complex scope mechanism of JavaScript variables. Let's put this part aside for a while. CoffeeScript simplifies the problem by eliminating the var declaration mechanism altogether. In short, in the CoffeeScript world, variables do not need to be declared in advance, just use them. And there is little danger in this usage.
At this point, I believe you have a deeper understanding of "what CoffeeScript is", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.