Code written in JavaScript must be executed from a document written in HTML.
There are three ways of doing this :
1. you can place the JavaScript between <script> tags within the <head> of the document :
2. a much better technique is to place your JavaScript code into a separate file. 
 
3. the best way is to place the <script> tag at the end of the document right before the closing 
</body> tag :
 
 
Placing the <script> tag at the end of the document lets the browser load the page faster. 

Programming languages are either interpreted or compiled. Languages like Java or C++ require a
compiler. A compiler is a program that translates the source code written in a high-level language like Java into a file that can be executed directly by a computer.
 
Interpreted languages dont require a complier -- they just need an interpreter instead.
With JavaScript, in the context of the World Wide Web, the web browser does the interpreting.

Without the interpreter, the JavaScript code would never be executed.

 
If there are any errors in the code written in a compiled language, those errors will pop up when the code is compiled. In the case of an interpreted language, errors won’t become apparent until the interpreter executes the code
 
 
 

3 ways of including JavaScript in HTML的更多相关文章

  1. JavaScript Libraries In A TypeScript Application, Revisited

    If you haven’t already gotten involved with it, you’ll probably know that TypeScript is becoming inc ...

  2. Code optimization and organization in Javascript / jQuery

    This article is a combined effort of Innofied Javascript developers Puja Deora and Subhajit Ghosh) W ...

  3. springcloud starter(一)

    Spring Cloud - Getting Started Example, 转载自:https://www.logicbig.com/tutorials/spring-framework/spri ...

  4. 翻译:打造Edge渲染内核的浏览器

    最近开始了解UWP和Edge内核,在微软技术博客中找到一篇文章,主要是介绍Edge渲染内核使用技术.顺手翻译了一下.不对之处请斧正! Over the past several months, we ...

  5. 轻松解决Linux安装Eclipse方法

    随着Linux的发展,很多人开始学习Linux系统,你了解Linux系统么?你是Linux系统的应用者么?本文为你详细介绍Linux安装Eclipse,为你在学习Linux安装Eclipse时起一定的 ...

  6. 30+学习Web设计和开发的优质新鲜资源

    今天我们整理了一些最新的Web设计和开发的资源,这些资源都来自国外的流行站点,不过大家应该不会陌生,放在这里供大家收藏,在需要的时候方便翻阅和学习! 原文地址:http://www.goodfav.c ...

  7. JS外链

    <script type=”text/javascript” src=”example.js”></script>   外链的javascript都有一个.js的后缀,但是这并 ...

  8. The Chain Of Responsibility (1)

    今天分享一下,设计模式中的责任链模式,其余的不过多叙述. 思路 在正式接触责任连之前,我们可以想象到的应该是一个链,链表?要处理一件事需要一个链似得?其实答案差不多就是这样.设计模式也都是从朴素的思维 ...

  9. 20+ Docs and Guides for Front-end Developers (No. 5)

    It’s that time again to choose the tool or technology that we want to brush up on. If you feel like ...

随机推荐

  1. Devexpress之GridControl显示序列号

    先上图: 操作方法: 1.先设置一下gridview中属性:IndicatorWidth,一般为:40.如下图:(一般可以显示5位数字.如要更长显示,自己测试一下.) 2.找到gridview中的:C ...

  2. 19.CentOS7下PostgreSQL安装过程

    CentOS7下PostgreSQL安装过程 装包 sudo yum install postgresql-server postgresql-contrib 说明: 这种方式直接明了,其他方法也可以 ...

  3. python类型之间的转换

    *int(x,base=10)x字符串或数字,base进制数,默认十进制 浮点转为整数 *float 整数转换为浮点型 *complex(1,2) 转换为复数 *str(10)将对象转换为字符串 *r ...

  4. GitHub上易于高效开发的Android开源项目TOP20--适合新手

    1. android-async-http android-async-http是Android上的一个异步.基于回调的HTTP客户端开发包,建立在Apache的HttpClient库上. 2. an ...

  5. 《Head First 设计模式》之观察者模式——天气显示

    观察者模式(Observer) ——在对象之间定义一对多的依赖,这样一来,当一个对象改变状态,依赖它的对象都会收到通知,并自动更新. (出版者Subject+订阅者Observer=观察者模式) 特点 ...

  6. bootstrapTable的数据后端分页排序

    数据后端分页排序,其实就是sql语句中oeder by做一些限制. 之前在写sql语句中的order by是写死,既然要写活,就要传参数到后台. 之前讲到bootstrapTable的queryPar ...

  7. 在Ubuntu中安装MySQL

    在Ubuntu中安装MySQL Ubuntu实用工具系列文章,将介绍基于Linux ubuntu的各种工具软件的配置和使用.有些工具大家早已耳熟能详,有些工具经常用到但确依然陌生.我将记录我在使用操作 ...

  8. 【java】使用URL和CookieManager爬取页面的验证码和cookie并保存

    使用java的net包和io包下的几个工具爬取页面的验证码图片并保存到本地. 然后可以把获取的cookie保存下来,做进一步处理.比如通过识别验证码,进一步使用验证码和用户名,密码,保存下来的cook ...

  9. 初识ListView - 定制ListView - 提升ListView运行效率

    ListView绝对可以称得上是 Android 中最常用的控件之一,几乎所有的应用程序都会用到它.由于手机屏幕空间都比较有限,能够一次性在屏幕上显示的内容并不多,当我们的程序中有大量的数据需要展示的 ...

  10. zabbix-2.2.2(Ubuntu 14.04 LTS/OpenLogic 7.2)

    平台: arm 类型: ARM 模板 软件包: apache-2.4.7 mariadb-5.5.50 mysql-5.5.52-0ubuntu0.14.04.1 php-5.4.16 php-5.5 ...