Javascript 简明教程

JavaScript Tutorial

JavaScript Tutorial

JavaScript 是一个轻量级、解释型的 programming 语言。它通常用于在 Web 应用程序中创建动态和交互式元素。 JavaScript 很容易实现,因为它与 HTML 集成。它是开放的跨平台语言。

JavaScript is a lightweight, interpreted programming language. It is commonly used to create dynamic and interactive elements in web applications. JavaScript is very easy to implement because it is integrated with HTML. It is open and cross-platform.

JavaScript tutorial 旨在帮助初学者以及在职专业人员理解 JavaScript 的从基础到高级的概念和功能。它涵盖了与 JavaScript 相关的许多重要概念,例如运算符、控制流、函数、对象、面向对象 programação、异步 JavaScript、事件、DOM 操作等等。

This JavaScript tutorial has been designed for beginners as well as working professionals to help them understand the basic to advanced concepts and functionalities of JavaScript. It covers most of the important concepts related to JavaScript such as operators, control flow, functions, objects, OOPs, Asynchronous JavaScript, Events, DOM manipulation and much more.

Why to Learn JavaScript?

JavaScript 是学生和在职专业人士成为优秀软件工程师的必备条件,尤其是在他们从事 Web 开发领域时。我们将列出学习 JavaScript 的一些主要好处−

JavaScript is a MUST for students and working professionals to become a great Software Engineer, especially when they are working in Web Development Domain. We will list down some of the key advantages of learning JavaScript−

  1. JavaScript is the most popular programming language in the world, making it a programmer’s great choice. Once you learn JavaScript, it helps you develop great front-end and back-end software using different JavaScript based frameworks like jQuery, Node.JS, etc.

  2. JavaScript is everywhere, it comes installed on every modern web browser and so to learn JavaScript, you really do not need any special environment setup. For example, Chrome, Mozilla Firefox, Safari, and every browser you know as of today, supports JavaScript.

  3. JavaScript helps you create really beautiful and crazy fast websites. You can develop your website with a console like look and feel and give your users the best Graphical User Experience.

  4. JavaScript usage has now extended to mobile app development, desktop app development, and game development. This opens many opportunities for you as JavaScript Programmer.

  5. Due to high demand, there is tons of job growth and high pay for those who know JavaScript. You can navigate over to different job sites to see what having JavaScript skills looks like in the job market.

  6. Great thing about JavaScript is that you will find tons of frameworks and Libraries already developed which can be used directly in your software development to reduce your time to market.

  7. JavaScript is in all over the world, and companies like Google, Meta, Microsoft, PayPal, LinkedIn, etc. also use JavaScript.

  8. Furthermore, JavaScript has more than 1.5 lakh libraries. It is also growing.

  9. A huge community of JavaScript is available on the internet with students, developers, and mentors. So anyone can easily get support.

学习 JavaScript 编程可能有一千个很好的理由。但有一点可以肯定,要学习任何 programming language ,不仅仅是 JavaScript,你只需要编码、编码,最后再编码,直到你成为专家。

There could be 1000s of good reasons to learn JavaScript Programming. But one thing for sure, to learn any programming language, not only JavaScript, you just need to code, and code, and finally code until you become an expert.

Applications of JavaScript Programming

如前所述,JavaScript 是使用最广泛的编程语言之一(既是前端,也是后端)。它几乎存在于软件开发的各个领域。我将在下面列出其中几个:

As mentioned before, JavaScript is one of the most widely used programming languages (Front-end as well as Back-end). It has its presence in almost every area of software development. I’m going to list few of them here:

  1. Client side validation − This is really important to verify any user input before submitting it to the server and JavaScript plays an important role in validating those inputs at front-end itself.

  2. Manipulating HTML Pages − JavaScript helps in manipulating HTML page on the fly. This helps in adding and deleting any HTML tag very easily using JavaScript and modify your HTML to change its look and feel based on different devices and requirements.

  3. User Notifications − You can use JavaScript to raise dynamic pop-ups on the webpages to give different types of notifications to your website visitors.

  4. Back-end Data Loading − JavaScript provides Ajax library which helps in loading back-end data while you are doing some other processing. This really gives an amazing experience to your website visitors.

  5. Presentations − JavaScript also provides the facility of creating presentations which gives website look and feel. JavaScript provides RevealJS and BespokeJS libraries to build a web-based slide presentation.

  6. Server Applications − Node JS is built on Chrome’s JavaScript runtime for building fast and scalable network applications. This is an event based library which helps in developing very sophisticated server applications including Web Servers.

  7. Machine learning − Developers can use the ML5.js library to complete the task related to machine learning.

  8. Game Developments − JavaScript contains multiple libraries and NPM packages to design graphics for the game. We can use HTML, CSS, and JavaScript with libraries to develop the games.

  9. Mobile applications − We can use frameworks like React Native to build feature-rich mobile applications.

  10. Internet of Things (IoT) − JavaScript is used to add functionality to devices like smartwatches, earbuds, etc.

  11. Data visualization − JavaScript contains the libraries like D3.js to visualize the data efficiently. The D3.js is also used to prepare high-quality charts to visualize the data.

  12. Cloud computing − We can use JavaScript in serverless computing platforms like Cloudflare and AWS lambda to write and deploy functions on the cloud.

这份清单还在继续,还有很多领域中,数百万软件开发人员愉悦地使用 JavaScript 开发出色的网站和其他软件。

This list goes on, there are various areas where millions of software developers are happily using JavaScript to develop great websites and other software.

Who Should Learn JavaScript?

JavaScript tutorial 已为学生和在职专业人员准备,以帮助他们了解 JavaScript 的基本功能,以便构建动态网页和 Web 应用程序。

This JavaScript tutorial has been prepared for student as well as working professionals to help them understand the basic functionality of JavaScript to build dynamic web pages and web applications.

Prerequisites to Learn JavaScript

对于本 JavaScript 教程,我们假设读者已具备 HTML 编码方面的先验知识。如果读者事先接触过面向对象编程的概念并对创建在线应用程序有基本了解,将会很有帮助。

For this JavaScript tutorial, it is assumed that the reader has prior knowledge of HTML coding. It would help if the reader had prior exposure to object-oriented programming concepts and a general idea of creating online applications.

JavaScript Online Quizzes

Javascript tutorial 有助于你为技术面试和认证考试做好准备。我们提供了各种测验和作业来检查你的学习水平。提供的测验为多项选择题,并附有简要说明作为答案。

This Javascript tutorial helps you prepare for technical interviews and certification exams. We have provided various quizzes and assignments to check your learning level. Given quizzes have multiple choice type of questions and their answers with short explanation.

以下是样本测验,请尝试回答任何给定的答案:

Following is a sample quiz, try to attempt any of the given answers:

开始在线测验 Start Javascript Quiz

Start your online quiz Start Javascript Quiz.

JavaScript Jobs

当今世界,有 1500 万活跃的 JavaScript 开发者。尽管如此,仍然缺乏熟练的 JavaScript 开发者。因此,这对你来说可能是开启 JavaScript 开发者职业生涯的绝佳机会。

In the world, there are 15+ Million active JavaScript developers. Still, there is a shortage of skilled JavaScript developers. So, it could be a great chance for you to start your career as a JavaScript developer.

以下是最受欢迎的公司,它们提供 JavaScript 开发者的职位。在你成为 JavaScript 开发者后,你就可以成为一名高薪员工。

Here are the most popular companies offering the role of JavaScript developer. You can land as an employee with a high package after pursuing your career as a JavaScript developer.

  1. Amazon

  2. Google

  3. Microsoft

  4. Apple

  5. Adobe

  6. Facebook

  7. PayPal

  8. Many more…​

Careers Opportunities in JavaScript

在学习 JavaScript 后,你可以选择多条职业道路。在这里,我们列出了一些。

There are several career paths that you can choose after learning JavaScript. Here, we have listed some of them.

  1. Front-end developer

  2. Back-end developer

  3. Full-stack developer

  4. Web developer

  5. Game developer

  6. Mobile App developer

  7. DevOps Engineer

  8. Many other roles

JavaScript Frameworks and Libraries

JavaScript 框架用于开发整个应用程序。它定义了应用程序的结构。

JavaScript frameworks are used to develop a whole application. It defines the structure of your application.

框架可能有预先构建的组件和其他功能,这些功能可以帮你复用应用程序的代码、提升代码可读性并避免重复。

The framework can have pre-built components and other functionalities that can help you reuse the code of the application, improve code readability, and avoid duplicity.

在此,我们解释了你可以用来进行网站开发、应用程序开发、后端开发等的热门 JavaScript 框架。

Here, we have explained the most popular JavaScript frameworks which you can use for website development, app development, backend development, etc.

  1. React

  2. Angular

  3. Vue.js

  4. Ember.js

  5. Node.js

  6. Backbone.js

  7. Next.js

  8. Mocha

  9. Meteor.js

  10. Polymer

在 JavaScript 中,库是一组预定义的功能、类、方法、对象等。你可以使用 CDN 或在本地下载的方式将该库导入 JavaScript 代码中。在将该库添加到项目后,你就可以在代码中使用该库的预写功能、类等。

In JavaScript, a library is a set of pre-defined functions, classes, methods, objects, etc. You can import the library in your JavaScript code by using the CDN or downloading it locally. After adding the library to the project, you can use the library’s pre-written functions, classes, etc., in the code.

在此,我们提供了一个热门 JavaScript 库列表。

Here, we have given a list of the most popular JavaScript libraries.

  1. jQuery

  2. Axios

  3. Chart.js

  4. D3.js

  5. Socket.io

  6. Underscore.js

  7. Lodash

  8. Three.js

Online JavaScript Editor

我们提供了 JavaScript Online Editor ,它可以帮你直接从浏览器中 EditExecute 代码。尝试点击图标 以运行以下 JavaScript 代码,以打印传统的“Hello, World!”。

We have provided JavaScript Online Editor which helps you to Edit and Execute the code directly from your browser. Try to click the icon to run the following JavaScript code to print conventional "Hello, World!".

<html>
   <head>
      <title>The JavaScript Example</title>
   </head>
   <body>
      <script language = "javascript" type = "text/javascript">
	     document.write("Hello World!")
      </script>
   </body>
</html>

JavaScript Certification

获得 JavaScript 认证以提升你的技能和职业生涯 Get certified

Get certified in JavaScript to boost your skills and career Get certified

Frequently Asked Questions about JavaScript

有一些关于 JavaScript 的常见问题解答 (FAQ),本部分将尝试简要回答这些问题。

There are some very Frequently Asked Questions(FAQ) about JavaScript, this section tries to answer them briefly.

JavaScript Articles

你可以浏览 JavaScript Articles 中的一组 JavaScript 文章

You can explore a set of JavaScript Articles at JavaScript Articles