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. Web 前端安装依赖的时候遇到的问题

  2. Android Asynchronous Http Client

    Features Make asynchronous HTTP requests, handle responses in anonymous callbacks HTTP requests happ ...

  3. wpf学习之(IValueConverter)

      学习IValueConverter的使用 public class StatuToNullableBoolConverter : IValueConverter { /// <summary ...

  4. 如何处理CloudFoundry应用部署时遇到的254错误

    使用SAP云平台的CloudFoundry部署应用: 在cockpit遇到错误信息:instance: a0abe2b5-7623-4cf1-4c65-0c79, index: 0, exit_des ...

  5. 如何在SAP Server Side JavaScript里消费destination

    在SAP云平台里打开SAP HANA Web-Based Development Workbench进行服务器端JavaScript的开发. 创建一个新的package: 创建一个新的applicat ...

  6. Windows环境下的Chocolatey安装使用

    Chocolatey是一个软件包管理工具,类似于Ubuntu下面的apt-get,不过是运行在Windows环境下面 电脑 Powershell 方法/步骤 安装 Chocolatey的安装需要: P ...

  7. IOS tableView 去除分割线 和 不允许选中表格cell

    //去除分割线 self.tableView.backgroundColor=[UIColor colorWithRed:///255.0 alpha:1.0]; self.tableView.sep ...

  8. centos下的安装mysql,jdk

    mysql: 如果你是用rpm安装, 检查一下RPM PACKAGE:rpm -qa | grep -i mysql如果mysql已经安装在本机,则会列出mysql安装过的文件 ,像mysql-ser ...

  9. UVALive 3530 Martian Mining(贪心,dp)

    分析: 对于网格grid[i][j]如果放向上的管道,那么grid[i][k], k>j 就只能放向上的管道了. 那么定义dp[i][j]表示第i行,最后一个放向左的管道是j的最大总矿量. j ...

  10. POJ-1936 All in All---字符串水题

    题目链接: https://vjudge.net/problem/POJ-1936 题目大意: 给两个字符串,判断是s1是不是s2的子序列 思路: 水 #include<iostream> ...