JavaScript难学吗?-程序员宅基地

技术标签: ViewUI  python  java  编程语言  js  javascript  

The degree of difficulty in learning JavaScript depends on the level of knowledge you bring to it. Because the most common way to run JavaScript is as part of a web page, you must first understand HTML. In addition, a familiarity with CSS is also useful because CSS (Cascading Style Sheets) provides the formatting engine behind the HTML.

学习JavaScript的难度取决于您所掌握的知识水平。 因为运行JavaScript的最常见方法是作为网页的一部分,所以您必须首先了解HTML。 此外,熟悉CSS也很有用,因为CSS(层叠样式表)提供了HTML背后的格式设置引擎。

比较JavaScript和HTML ( Comparing JavaScript to HTML )

HTML is a markup language, meaning that it annotates text for a particular purpose and it's human-readable. HTML is a fairly straightforward and simple language to learn. 

HTML是一种标记语言,这意味着它可以为特定目的注释文本,并且易于阅读。 HTML是一种相当简单易学的语言。

Each piece of content is wrapped inside HTML tags that identify what that content is. Typical HTML tags wrap paragraphs, headings, lists and graphics, for example. An HTML tag encloses the content within angle brackets, with the tag name appearing first followed by a series of attributes. The closing tag to match an opening tag is identified by placing a slash in front of the tag name. For example, here's a paragraph element:

每段内容都包装在HTML标记内,这些标记标识该内容是什么。 例如,典型HTML标签包含段落,标题,列表和图形。 HTML标签将内容括在尖括号中,标签名称首先出现,然后是一系列属性。 与开始标签匹配的结束标签是通过在标签名称前面放置斜杠来标识的。 例如,这是一个段落元素:

And here is the same paragraph element with an attribute title:

这是具有属性标题的同一段落元素:

JavaScript, however, is not a markup language; rather, it is a programming language. That by itself is enough to make learning JavaScript a lot more difficult than HTML. While a markup language describes what something is, a programming language defines a series of actions to be performed. Each command written in JavaScript defines an individual action — which can be anything from copying a value from one place to another, performing calculations on something, testing a condition, or even providing a list of values to be used in running a long series of commands that have been previously defined.

但是,JavaScript不是标记语言。 而是一种编程语言。 这本身就足以使学习JavaScript比HTML困难得多。 标记语言描述了什么,而编程语言定义了一系列要执行的动作 。 每个用JavaScript编写的命令都定义了一个单独的动作-可以是将一个值从一个地方复制到另一个地方,对某物进行计算,测试条件,甚至提供要用于运行一系列命令的值列表之类的任何操作之前已经定义的

As there are lots of different actions that can be performed and those actions can be combined in many different ways, learning any programming language is going to be more difficult than learning a markup language.

由于可以执行许多不同的动作,并且可以用许多不同的方式组合这些动作,因此学习任何一种编程语言都比学习标记语言要困难得多。

However, there's a caveat: To be able to properly use a markup language, you need to learn the entire language. Knowing part of a markup language without knowing the rest means that you cannot mark up all of the page content correctly. But knowing a part of a programming language means that you can write programs that use the part of the language that you know to create programs.

但是,有一个警告:要正确使用标记语言,您需要学习整个语言。 不了解标记语言的其余部分而知道标记语言的一部分意味着您无法正确标记所有页面内容。 但是,了解一部分编程语言意味着您可以编写使用一部分已知语言来创建程序的程序。

While JavaScript is more complex than HTML, you can start writing useful JavaScript far more quickly than you might take to learn how to correctly mark up web pages with HTML. It will, however, take you a lot longer to learn everything that can be done with JavaScript compared to HTML.

尽管JavaScript比HTML更复杂,但是您可以比学习如何正确地用HTML标记网页更快地开始编写有用JavaScript。 但是,与HTML相比,它需要花费更多的时间来学习JavaScript可以完成的所有工作。

将JavaScript与其他编程语言进行比较 ( Comparing JavaScript to Other Programming Languages )

If you already know another programming language, then learning JavaScript will be much easier for you than it was to learn that other language. Learning your first programming language is always the hardest, because when you learn a second and subsequent language that uses a similar programming style, you already understand the programming style and just need to learn how the new language sets out its specific command syntax.

如果您已经知道另一种编程语言,那么学习JavaScript比学习另一种语言要容易得多。 学习第一种编程语言总是最困难的,因为当您学习使用类似编程风格的第二种及后续语言时,您已经了解了该编程风格,只需要学习新语言如何设置其特定的命令语法即可。

编程语言样式的差异 ( Differences in Programming Language Styles )

Programming languages have different styles. If the language you already know has the same style, or paradigm, than does JavaScript, learning JavaScript will be fairly easy. JavaScript supports two styles: procedural, or object oriented. If you already know a procedural or object-oriented language, you will find learning to write JavaScript the same way relatively easy.

编程语言具有不同的样式。 如果您已经知道的语言与JavaScript具有相同的样式或范例,那么学习JavaScript将会非常容易。 JavaScript支持两种样式: 过程式面向对象 。 如果您已经知道一种过程语言或面向对象的语言,就会发现学习以相同的方式编写JavaScript相对容易。

Another way in which programming languages differ is that some are compiled while others are interpreted:

编程语言与众不同的另一种方式是,有些被编译而另一些被解释:

  • A compiled language is fed through a compiler which converts the entire code into something that the computer can understand. The compiled version is what gets run; if you need to make changes to the program, you must recompile the program before running it again.

    编译语言通过编译器提供,编译器将整个代码转换为计算机可以理解的内容。 编译后的版本将运行。 如果需要更改程序,则必须在重新运行该程序之前重新编译该程序。

  • An interpreted language converts the code into something the computer can understand at the time the individual commands are run; this kind of language is not compiled in advance. JavaScript is an interpreted language, which means that you can make changes to your code and run it again straight away to see the effect of your change without having to recompile the code.

    解释语言将代码转换为计算机在运行各个命令时可以理解的内容。 这种语言不是预先编译的。 JavaScript是一种解释型语言,这意味着您可以对代码进行更改,然后立即再次运行它以查看更改的效果,而无需重新编译代码。

各种语言的测试要求 ( Testing Requirements for Various Languages )

Another difference between programming languages is where they can be run. For example, programs that are intended to run on a web page require a web server that is running the appropriate language.

编程语言之间的另一个区别是可以在哪里运行它们。 例如,要在网页上运行的程序需要运行适当语言的Web服务器。

JavaScript is similar to several other programming languages, so knowing JavaScript will make it fairly easy to learn the similar languages. Where JavaScript has the advantage is that support for the language is built into web browsers — all you need to test your programs as you write them is a web browser to run the code in — and just about everyone has a browser already installed on their computer. To test your JavaScript programs, you don't need to install a server environment, upload the files to a server elsewhere, or compile the code. This makes JavaScript an ideal choice as a first programming language.

JavaScript与其他几种编程语言相似,因此了解JavaScript将使学习类似语言变得相当容易。 JavaScript的优势在于Web浏览器中内置了对该语言的支持-编写程序时只需测试一下程序,即可在其中运行代码的Web浏览器-几乎每个人的计算机上都已经安装了浏览器。 要测试JavaScript程序,无需安装服务器环境,将文件上传到其他地方的服务器或编译代码。 这使JavaScript成为第一种编程语言的理想选择。

Web浏览器的差异及其对JavaScript的影响 ( Differences in Web Browsers and Their Effect on JavaScript )

The one area in which learning JavaScript is harder than other programming languages is that different web browsers interpret some JavaScript code slightly differently. This introduces an extra task into JavaScript coding that several other programming languages don't need — that of testing how a given browser expects to perform certain tasks.

学习JavaScript其他编程语言更难的一个方面是,不同的Web浏览器对某些JavaScript代码的解释略有不同。 这在JavaScript编码中引入了额外的任务,而这是其他几种编程语言所不需要的—测试给定浏览器如何执行某些任务。

结论 ( Conclusions )

In many ways, JavaScript is one of the easiest programming language to learn as your first language. The way that it functions as an interpreted language within the web browser means that you can easily write even the most complex code by writing it a small piece at a time and testing it in the web browser as you go. Even small pieces of JavaScript can be useful enhancements to a web page, and so you can become productive almost immediately.

在许多方面,JavaScript是作为您的第一门语言学习的最简单的编程语言之一。 它在Web浏览器中充当解释语言的方式意味着您可以一次编写一小段代码,然后在Web浏览器中对其进行测试,从而轻松编写甚至是最复杂的代码。 即使是很小JavaScript片段也可以是对网页的有用增强 ,因此您几乎可以立即提高工作效率。

翻译自: https://www.thoughtco.com/how-hard-is-javascript-to-learn-2037676

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/cumao2792/article/details/108574734

智能推荐

栈——后进先出(LIFO:last in first out)_栈的后进先出例题-程序员宅基地

文章浏览阅读2.9k次,点赞2次,收藏2次。栈:后进先出(LIFO:last in first out)例如:自助餐中的自取餐盘面试题目:有六个元素6 5 4 3 2 1 的顺序进栈,哪一个不是合法的出栈序列:A. 5 4 3 6 1 2 B.4 5 3 2 1 6 C.3 4 6 5 2 1 D.2 3 4 1 5 6解析:进入栈的顺序保持6 5 4 3 2 1 ,3出栈所以栈中现在是从栈底-->栈顶依次为6..._栈的后进先出例题

java实现post请求(PostMethod)-程序员宅基地

文章浏览阅读3.9k次。项目要求:实现post请求,且请求格式是json格式。maven依赖包<dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.3</version></dependency><dependency> ..._postmethod

N皇后问题-n 皇后问题研究的是如何将 n 个皇后放置在 n×n 的棋盘上,并且使皇后彼此之间不能相互攻击。_在n×n的方格棋盘放置3个皇后,任意两个皇后不能相邻,否则她们会相互攻击(也就是说-程序员宅基地

文章浏览阅读4.4k次。n 皇后问题研究的是如何将 n 个皇后放置在 n×n 的棋盘上,并且使皇后彼此之间不能相互攻击。相互攻击就是说:在同一行、同一列或者在同一斜线方向时,不能同时存在两个皇后。示例:输入: 4输出: [ [".Q..", // 解法 1 "...Q", "Q...", "..Q."], ["..Q.", // 解法 2 "Q...", "...Q", ".Q..._在n×n的方格棋盘放置3个皇后,任意两个皇后不能相邻,否则她们会相互攻击(也就是说

使用Docker安装达梦数据库_docker pull安装达梦8-程序员宅基地

文章浏览阅读1.8k次。前言最近公司要求对老项目进行维护,需要安装达梦数据库,我采用了centos7.8的docker进行安装,这里做个记录。一、docker的安装查看当前centos系统内核版本,高于3.10才能安装docker#uname -r下载和安装docker#yum -y install docker安装完成后,查看docker版本#docker version启动docker服务#systemctl start docker设置docker开机启动#systemctl enable _docker pull安装达梦8

Springboot集成高低版本kafka_spring-kafka版本-程序员宅基地

文章浏览阅读3.7k次。springboot整合kafka的时候一定要根据自己springboot版本选择对应版本的kafka,两者版本对应关系可以直接查看官网。_spring-kafka版本

Java性能优化:数据传输优化_java数据推送方案优化-程序员宅基地

文章浏览阅读1.2k次。数据传输优化一、前言客户端与服务端经常进行着频繁的数据传输,数据传输又影响着用户体验,本小节就传输速率的优化,整理了部分注意事项。二、数据传输优化2.1 减少数据字节数:在开始的时候,采用的是xml传输,这就要使用到Serializable/Parcelable序列化以及反序列化,其传输速度之慢,基本已经被遗弃,后来又出现了JSON序列化传输,其常用工具就是GSON和fastjson,但随着时代的进步,json也体现出了局限性json的局限性主要体现在其是基于字符串的传输,在_java数据推送方案优化

随便推点

QT常见错误:"multiple definition of xxx"_e:\34[c++]\11[20230323qt_test]\example\contach.cpp-程序员宅基地

文章浏览阅读904次。错误原因重复定义解决方法打开QT工程文件*.pro查看SOURCES += \ 以及 HEADERS += \下方是否有重复的源文件名或头文件名,删掉重复的即可_e:\34[c++]\11[20230323qt_test]\example\contach.cpp:3: error: multiple defini

ajax jsonp跨域_ajax 什么时候 jsonp跨域-程序员宅基地

文章浏览阅读1.6k次。js跨域问题是指:js在不同的域之间进行数据传输或通信,比如用ajax向一个不同的域请求数据,或者通过js获取页面中不同域的框架中(iframe)的数据。只要协议、域名、端口有任何一个不同,都被当作是不同的域。js跨域参考:http://www.cnblogs.com/2050/p/3191744.html可以通过jsonp实现js跨域,但是获取的数据必须是脚本文件,例如json。下面_ajax 什么时候 jsonp跨域

自然语言处理(NLP)学习路线总结_nlp自然语言处理流程-程序员宅基地

文章浏览阅读1.2k次,点赞2次,收藏29次。文章目录1、自然语言处理概述2、自然语言处理入门基础2.1 数学基础2.2 语言学基础2.3 Python基础2.4 机器学习基础2.5 深度学习基础2.6 自然语言处理的理论基础3、自然语言处理的主要技术范畴3.1 语义文本相似度分析3.2 信息检索(Information Retrieval, IR)3.3 信息抽取(Information Extraction)3.4 文本分类(Text Categorization)3.5 文本挖掘(Text Mining)3.6 文本情感分析(Textual Af_nlp自然语言处理流程

【转载】梦断计院--一个计算机学院学生大学学习生活的回顾与反省-程序员宅基地

文章浏览阅读272次。作为正值大学毕业的我,无意中看到这篇博文,只看了点开头,就决定给他转载。此刻的我没有工作,时不时的还得为感情事而发愁,一天天的吵架,合好,吵架。我也不像以前的我啦,学习没激情,目标不坚定,生活挺颓废,工作也不找,整天待在寝室进行所谓的“学习”,其实是为工作做准备,把这大学以来丢的东西补上,然后再去找工作,学到现在,也没发觉学得怎么样,离成为一个合格的计算机科学与技术专业的学生相差甚远。

洛谷P4180 严格次小生成树-程序员宅基地

文章浏览阅读360次。题意就是求严格次小生成树。其实思路挺明确的,跟非严格次小生成树差不多。那么先回忆一下非严格次小生成树:先求出最小生成树,再利用Kruskal的贪心思路,对每一条非树边求它连成的环上最大的一条边,用这条非树边替换掉,对于替换掉每一条边后的树权值取min就是答案。严格与非严格的区别:不能相等了。所以好像只求最大值会出问题,如果一个环上有两条一样长的边,得到的结果就是非严格的。所以改进算法,倍增..._p4180

java的cp命令_"java -cp \"./bin"-程序员宅基地

文章浏览阅读9.6k次。-cp 参数后面是类路径,是指定给解释器到哪里找到你的.class文件, 写法: java -cp .;myClass.jar packname.mainclassname classpath中的jar文件能使用通配符,如果是多个jar文件,要一个一个地罗列出来,从某种意义上说jar文件也就是路径。要指定各个JAR文件具体的存放路径,相同路径有多个可使用通配符 java -cp .;c:/classes/myClass.jar;d:_"java -cp \"./bin"