• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
LilyLiya
博客园    首页    新随笔    联系   管理    订阅  订阅
js basics
js basics day 1

refer to : https://www.udemy.com/course/the-web-developer-bootcamp/

1. primitive types基本类型

  • the basic building blocks
    • Number
    • String
    • Boolean
    • Null
  • technically, there are two other primitive types, Symbol and BigInt

Undefiend.  eg: youtube web page, 点赞数:number; 标题: string;是否订阅: boolean; 在console里面写js注释的时候,返回类型是undefined


2. Numbes IN JS

Js has one number type: positive numbers, negative numbers, whole numbers(integers), decimal numbers


 

3. basic operations:addtion, substraction, multiplication, division.

%  modulo.    remainder operator: check number is odd or even

** exponentiation    2**4 = 16.    two to the fourth power


 

 4. what is NAN?

It is NOT A NUMBER.  eg: 0/0.   1 + NAN


5. Variables & let

basic syntax: let someName = value;   keywork: let

 


6. clear().  to clear console


7. const. const works just like let, except you can not change the value.

why use const: to define some unchanged variables, const variables can not be reassigned.

eg: const pi = 3.14159.  const daysInWeek = 7.  


 8.  camel-cased, with the first letter lowercased.


 

9. In JS, the variables can be changed into another type, but in typescript, there are restrictions, you can not change the variables' type.


 

posted on 2021-01-07 02:06  LilyLiya  阅读(89)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3