zoukankan      html  css  js  c++  java
  • JavaScript基础

    1. 直接在script标签内部书写代码

     
     
     
     
     
    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <title></title>
        <script type="text/javascript">
          console.log('hello, world');
        </script>
      </head>
      <body>
      </body>
    </html>
     
    1. 通过script标签的src属性,引入外部的JavaScript文件

     
     
     
     
     
    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <title></title>
      </head>
      <body>
        <script type="text/javascript" src="./index.js"></script>
      </body>
    </html>
     

    数据类型

    在JavaScript中一种有5种原始类型

    • 数值类型(number)

    • 字符串类型(string)

    • 布尔值类型(boolean)

    • null

    • undefined

    变量的命名规则

    命名规则:

    • 第一个字符可以是任意Unicode大小写字母,以及美元符号($)和下划线(_)。

    • 第二个字符及后面的字符,还可以用数字。

      • 不能使用保留字作为变量名

    JavaScript保留字

    abstractboolean break bytecase

    catch char class const continue

    debugger default delete do doubleelse enum

    export extendsfalse final finally float for function

    gotoif implements import in instanceof int interfacelong

    native new nullpackage private protected publicreturnshort static

    super switch synchronizedthis throw throws transient

    true try typeofvar void volatilewhile with

     

  • 相关阅读:
    hiho#1445 重复旋律5 求子串数量 后缀自动机
    SPOJ LCS2 后缀自动机
    SPOJ-LCS 后缀自动机
    bzoj 3261 最大异或和 可持久化字典树(01树)
    【洛谷1297】单选错位
    【HAOI2008】木棍分割
    【SDOI2016】排列计数
    【HAOI2008】下落的圆盘
    【HAOI2008】硬币购物
    【洛谷5520】青原樱
  • 原文地址:https://www.cnblogs.com/LeiFenggreed/p/5968143.html
Copyright © 2011-2022 走看看