javascript入门

JavaScript is one of the most popular programming languages in the world.

JavaScript是世界上最受欢迎的编程语言之一。

I believe it's a great choice for your first programming language ever.

我相信这是您有史以来第一门编程语言的绝佳选择。

We mainly use JavaScript to create

我们主要使用JavaScript创建

  • websites
    网站
  • web applications
    网络应用
  • server-side applications using Node.js
    使用Node.js的服务器端应用程序

but JavaScript is not limited to these things, and it can also be used to

但是JavaScript不仅限于这些东西,它还可以用于

  • create mobile applications using tools like React Native
    使用React Native等工具创建移动应用程序
  • create programs for microcontrollers and the internet of things
    为微控制器和物联网创建程序
  • create smartwatch applications
    创建smartwatch应用程序

It can basically do anything. It's so popular that everything new that shows up is going to have some kind of JavaScript integration at some point.

它基本上可以做任何事情。 它是如此流行,以至于出现的所有新事物都将在某种程度上进行某种JavaScript集成。

JavaScript is a programming language that is:

JavaScript是一种编程语言,它是:

  • high level: it provides abstractions that allow you to ignore the details of the machine where it's running on. It manages memory automatically with a garbage collector, so you can focus on the code instead of managing memory like other languages like C would need, and provides many constructs which allow you to deal with highly powerful variables and objects.

    高级别 :它提供抽象,使您可以忽略正在运行的计算机的详细信息。 它使用垃圾回收器自动管理内存,因此您可以专注于代码,而不必像C之类的其他语言那样管理内存,并提供许多构造,使您可以处理功能强大的变量和对象。

  • dynamic: opposed to static programming languages, a dynamic language executes at runtime many of the things that a static language does at compile time. This has pros and cons, and it gives us powerful features like dynamic typing, late binding, reflection, functional programming, object runtime alteration, closures and much more. Don't worry if those things are unknown to you - you'll know all of them by the end of the course.

    动态的 :与静态编程语言相反,动态语言在运行时执行静态语言在编译时执行的许多操作。 这具有优缺点,并且为我们提供了强大的功能,例如动态类型输入,后期绑定,反射,函数式编程,对象运行时更改,闭包等等。 如果您不知道这些事情,请不要担心-在课程结束时,您将了解所有这些内容。

  • dynamically typed: a variable does not enforce a type. You can reassign any type to a variable, for example, assigning an integer to a variable that holds a string.

    动态类型的 :变量不强制类型。 您可以将任何类型重新分配给变量,例如,将整数分配给包含字符串的变量。

  • loosely typed: as opposed to strong typing, loosely (or weakly) typed languages do not enforce the type of an object, allowing more flexibility but denying us type safety and type checking (something that TypeScript - which builds on top of JavaScript - provides)

    松散类型 :与强类型相反,松散(或弱类)语言不会强制执行对象的类型,从而提供了更大的灵活性,但拒绝了我们进行类型安全性和类型检查(基于JavaScript的TypeScript提供的功能)

  • interpreted: it's commonly known as an interpreted language, which means that it does not need a compilation stage before a program can run, as opposed to C, Java or Go for example. In practice, browsers do compile JavaScript before executing it, for performance reasons, but this is transparent to you - there is no additional step involved.

    解释型 :它通常称为解释型语言,这意味着它可以在程序可以运行之前不需要编译阶段,例如,与C,Java或Go相对。 实际上,出于性能原因,浏览器会在执行JavaScript之前先对其进行编译,但这对您来说是透明的-无需执行其他任何步骤。

  • multi-paradigm: the language does not enforce any particular programming paradigm, unlike Java for example, which forces the use of object-oriented programming, or C that forces imperative programming. You can write JavaScript using an object-oriented paradigm, using prototypes and the new (as of ES6) classes syntax. You can write JavaScript in a functional programming style, with its first-class functions, or even in an imperative style (C-like).

    多范式语言不强制执行任何特定的编程范式,例如不同于Java,Java强制使用面向对象的编程,而C则强制执行命令式编程。 您可以使用面向对象的范例,原型和新的(从ES6开始)类语法来编写JavaScript。 您可以使用功能性编程风格,一流的功能甚至是命令式风格(类似于C)来编写JavaScript。

In case you're wondering, JavaScript has nothing to do with Java, it's a poor name choice but we have to live with it.

如果您想知道, JavaScript与Java无关 ,这是一个糟糕的选择,但我们必须忍受它。

手册摘要 (Summary of the handbook)

  1. A little bit of history

    一点历史

  2. Just JavaScript

    只是JavaScript

  3. A brief intro to the syntax of JavaScript

    JavaScript语法简介

  4. Semicolons

    分号

  5. Values

    价值观

  6. Variables

    变数

  7. Types

    种类

  8. Expressions

    表达方式

  9. Operators

    经营者

  10. Precedence rules

    优先规则

  11. Comparison operators

    比较运算符

  12. Conditionals

    有条件的

  13. Arrays

    数组

  14. Strings

    弦乐

  15. Loops

    循环

  16. Functions

    功能

  17. Arrow functions

    箭头功能

  18. Objects

    对象

  19. Object Properties

    对象属性

  20. Object Methods

    对象方法

  21. Classes

    班级

  22. Inheritance

    遗产

  23. Asynchonous Programming and Callbacks

    异步编程和回调

  24. Promises

    承诺

  25. Async and Await

    异步并等待

  26. Variable scope

    可变范围

  27. Conclusion

    结论

Update: You can now get a PDF and ePub version of this JavaScript Beginner's Handbook.

更新: 您现在可以获得本JavaScript初学者手册的PDF和ePub版本 。

一点历史 (A little bit of history)

Created in 1995, JavaScript has gone a very long way since its humble beginnings.

自1995年创建以来,JavaScript的不起眼发展就已经走了很长一段路。

It was the first scripting language that was supported natively by web browsers, and thanks to this it gained a competitive advantage over any other language and today it's still the only scripting language that we can use to build Web Applications.

它是Web浏览器本地支持的第一种脚本语言,并且由于它,它比其他任何语言都具有竞争优势,并且今天它仍然是我们可以用来构建Web应用程序的唯一脚本语言。

Other languages exist, but all must compile to JavaScript - or more recently to WebAssembly, but this is another story.

还存在其他语言,但是所有语言都必须编译为JavaScript,或者最近才可以编译为WebAssembly,但这是另一回事了。

In the begining, JavaScript was not nearly powerful as it is today, and it was mainly used for fancy animations and the marvel known at the time as Dynamic HTML.

刚开始时,JavaScript并不像今天那样强大,它主要用于精美的动画和当时称为Dynamic HTML的奇迹。

With the growing needs that the web platform demanded (and continues to demand), JavaScript had the responsibility to grow as well, to accommodate the needs of one of the most widely used ecosystems of the world.

随着Web平台不断增长的需求(并继续满足),JavaScript 有责任不断增长,以适应世界上使用最广泛的生态系统之一的需求。

JavaScript is also now widely used outside of the browser. The rise of Node.js in the last few years unlocked backend development, once the domain of Java, Ruby, Python, PHP, and more traditional server-side languages.

现在,JavaScript在浏览器之外也被广泛使用。 过去几年,Node.js的兴起解锁了后端开发,而后端开发曾经是Java,Ruby,Python,PHP和更传统的服务器端语言的领域。

JavaScript is now also the language powering databases and many more applications, and it's even possible to develop embedded applications, mobile apps, TV apps, and much more. What started as a tiny language inside the browser is now the most popular language in the world.

现在,JavaScript也是语言为数据库和更多应用程序提供了动力,甚至有可能开发嵌入式应用程序,移动应用程序,电视应用程序等。 从浏览器内部的一种很小的语言开始,到现在是世界上最受欢迎的语言。

只是JavaScript (Just JavaScript)

Sometimes it's hard to separate JavaScript from the features of the environment it is used in.

有时很难将JavaScript与使用环境的功能区分开。

For example, the console.log() line you can find in many code examples is not JavaScript. Instead, it's part of the vast library of APIs provided to us in the browser.

例如,您可以在许多代码示例中找到的console.log()行不是JavaScript。 相反,它是浏览器中提供给我们的庞大API库的一部分。

In the same way, on the server it can be sometimes hard to separate the JavaScript language features from the APIs provided by Node.js.

同样,有时在服务器上有时很难将JavaScript语言功能与Node.js提供的API分开。

Is a particular feature provided by React or Vue? Or is it "plain JavaScript", or "vanilla JavaScript" as it's often called?

React或Vue是否提供特定功能? 还是通常所说的“普通JavaScript”或“普通JavaScript”?

In this book I talk about JavaScript, the language.

在这本书中,我将讨论JavaScript,即语言。

Without complicating your learning process with things that are outside of it, and provided by external ecosystems.

不会使您的学习过程与外部生态系统所提供的外部事物复杂化。

JavaScript语法简介 (A brief intro to the syntax of JavaScript)

In this little introduction I want to tell you about 5 concepts:

在这个小介绍中,我想向您介绍5个概念:

  • white space
    空白空间
  • case sensitivity
    区分大小写
  • literals
    文字
  • identifiers
    身份标识
  • comments
    注释

空格 (White space)

JavaScript does not consider white space meaningful. Spaces and line breaks can be added in any fashion you might like, at least in theory.

JavaScript认为空白没有意义。 至少从理论上讲 ,可以以任何您喜欢的方式添加空格和换行符。

In practice, you will most likely keep a well defined style and adhere to what people commonly use, and enforce this using a linter or a style tool such as Prettier.

在实践中,您很可能会保持定义明确的样式并遵守人们常用的样式,并使用短绒棉布或样式工具(例如Prettier)来强制实施。

For example, I always use 2 space characters for each indentation.

例如,我总是对每个缩进使用2个空格字符。

区分大小写 (Case sensitive)

JavaScript is case sensitive. A variable named something is different than Something.

JavaScript区分大小写。 名为something的变量不同于Something

The same goes for any identifier.

任何标识符也是如此。

文字 (Literals)

We define literal as a value that is written in the source code, for example, a number, a string, a boolean or also more advanced constructs, like Object Literals or Array Literals:

我们将文字定义为在源代码中写入的值,例如,数字,字符串,布尔值或其他更高级的构造,例如对象文字或数组文字:

5
'Test'
true
['a', 'b']
{color: 'red', shape: 'Rectangle'}

身份标识 (Identifiers)

An identifier is a sequence of characters that can be used to identify a variable, a function, or an object. It can start with a letter, the dollar sign $ or an underscore _, and it can contain digits. Using Unicode, a letter can be any allowed character, for example, an emoji

javascript入门_JavaScript入门手册(2020版)相关推荐

  1. 钢材规格解读的软件_钢材重量计算软件下载-钢材重量手册2020版下载 v3.71免费版--pc6下载站...

    钢材重量计算软件,其中包含常用钢板.工字钢.角钢.槽钢.H型钢.无缝管.钢管.钢轨.C型钢理论重量的计算.磅差处理.金额大写转换等功能.. 相关软件软件大小版本说明下载地址 钢材重量计算软件,其中包含 ...

  2. dumpbin发现没有入口函数_JavaScript基础之入口函数-2020版

    JavaScript基础之入口函数-2020版 1.入口函数 window.onload = function(){ 内部放js} 这个函数的意思就是说,当我们页面加载完毕之后(就是说等页面的结构 样 ...

  3. 《2020版JavaScript基础入门教程全集》,助你一臂之力!

    当下,随着5G商用正在有序推进,很多传统的前端工程师并不能满足时下企业用人需求了,越来越多的开发模式以及前端框架不断的涌现出来,这也就要求程序员需要不断去自我增值. 前端要学习的东西很多,对于自学的小 ...

  4. 网站推广必备手册:SEO教程:搜索引擎优化入门与进阶(第2版)

    网站推广必备手册:SEO教程:搜索引擎优化入门与进阶(第2版) [作 者]吴泽欣 [同作者作品] [作译者介绍]  [丛 书 名] 图灵程序设计丛书  [出 版 社] 人民邮电出版社     [书 号 ...

  5. 《JavaScript入门经典(第6版)》——2.7 问答

    本节书摘来自异步社区<JavaScript入门经典(第6版)>一书中的第2章,第2.7节,作者: [美] Phil Ballard 译者:李 军陈冀康,更多章节内容可以访问云栖社区&quo ...

  6. 《JavaScript入门经典(第4版)》上第5章一个实例程序的修正,完善

    今日,做<JavaScript入门经典(第4版)>第5章上的一个例题,感觉书上的代码有个小错误. 这是ch5_examp5.html上的一个实例,是计算一个数x保留y小数位后,四舍五入的结 ...

  7. 视频教程-PHP7入门手册视频版第一季-PHP

    PHP7入门手册视频版第一季 2009年4月创办 淄博日诺网络科技有限公司 法人总经理 2016年负责 中国传媒大学凤凰学院 网站开发 项目负责人 2017年 参与负责 用友软件理财项目开发 郭孟涛 ...

  8. 视频教程-PHP7入门手册视频版第二季-PHP

    PHP7入门手册视频版第二季 2009年4月创办 淄博日诺网络科技有限公司 法人总经理 2016年负责 中国传媒大学凤凰学院 网站开发 项目负责人 2017年 参与负责 用友软件理财项目开发 郭孟涛 ...

  9. 视频教程-PHP7入门手册视频版第六季 PSR 标准规范-PHP

    PHP7入门手册视频版第六季 PSR 标准规范 2009年4月创办 淄博日诺网络科技有限公司 法人总经理 2016年负责 中国传媒大学凤凰学院 网站开发 项目负责人 2017年 参与负责 用友软件理财 ...

最新文章

  1. linux下面显示所有正在运行的线程
  2. Mac OS Mountain Lion 下的Wireshark
  3. c++ 11新特性总结_JDK1.8新特性Stream和Collectors19个常用示例总结
  4. Service Fabric 用 Powershell 部署应用到本地
  5. 第12秒做视频封面:阿里云视频截帧功能
  6. 初识Paramiko
  7. Hadoop 安装目录及配置
  8. 库存商品表html源码,JSP+Servlet+数据库的方式完成一个简易的库存商品管理系统...
  9. Gartner发布云产品评估报告:阿里云计算能力全球第一
  10. 解决Git Log在IDEA中乱码的问题
  11. web安全day6:IIS之WEB服务器
  12. linux的df命令根目录,详细分析Linux df命令的使用方法
  13. 181113每日一句
  14. java的运行环境是什么_Java运行环境是什么
  15. HTML分页插件功能实现
  16. 失恋33天——我用57天考了一个5A
  17. 当老鼠拥有“鹰眼”,人类世界会发生什么变化?
  18. 千古绝唱——陆游和唐琬
  19. LVM 扩容---LVM扩展系统的根分区
  20. 2017《Java预备作业2》计科1502杨雪莹

热门文章

  1. 【AI视野·今日CV 计算机视觉论文速览 第239期】Wed, 3 Nov 2021
  2. JupyterNotebook配置远程登录
  3. Matlab导出高DPI图像——生成高分辨率.eps .tiff .jpg
  4. media player的显示模式 winform
  5. java字符串的方法 1118
  6. 包的实际操作 java
  7. 爬虫-视频资源的爬取
  8. vue v2.5.0源码-双向数据绑定
  9. Nexus修改admin密码及其添加用户
  10. CSS魔法堂:选择器及其优先级