什么是js
什么是js JavaScript简称JS,是较为流行的一种前端编程语言,是一种脚本语言,通过解释器运行,主要在客户端(浏览器)上运行,也可以基于node.js在服务器端运行 前端所使用的编程语言

什么是js

发布时间:2024-07-01 (2024-07-01)

什么是js

JavaScript简称JS,是较为流行的一种前端编程语言,是一种脚本语言,通过解释器运行,主要在客户端(浏览器)上运行,也可以基于node.js在服务器端运行

  1. 前端所使用的编程语言
  2. 弱类型动态语言

使用js的三种方式

  1. 行内
<button onclick="alert('你点到我了')">点我</button>
  1. 内嵌

可以在任何地方引入

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>引入js</title>
    <script>
        console.log("hello world head里面")
    </script>
</head>
<body>
<script>
    console.log("hello world body里面")
</script>
</body>
<script>
    console.log("hello world body外面")
</script>
</html>
<script>
    console.log("hello world html的外面")
</script>
  1. 外部引入
<script src="index.js"></script>