#13 JS: Intro to Data, Variables, Operators

Data: Number, String, Boolean

  • Number: e.g. 7, 17
  • String: consist of quotation marks and semicolon, e.g. “this is a string”;
  • Boolean: e.g. true, false

Variables

A variable is a container for storing data or values.
*Please note that it displays as the order we code.

Example

var x; → let's declare the variable as x.
x=17; → and we start to store value into the variable. 
alert(x); 
x="value";
alert(x);
var y=true;

Operators

Operators is like math formulas, consisting of various characters.
Let’s explain the formulas and terms by examples...

When we write

3+5; → Arithmetic operators
alert(3+5);

=> The result is 8.

var result=3*5; → Assignment operators
alert(result);

=> The result is 15.

Follow the last operator

result++; → increment (++) operators. It means the result has to plus 1, which can also be written as “result+1;”
alert(result);

=> The result is 16.

4<3; → Comparison operators.
result=4<3; 
alert(result);

=> The boolean is “true.” If we write 4<3, the boolean is “false.”

var data=3;
result=data*data;
alert(result);

=> The result is 9.

alert(data);

=> The result is 3.


Music of Today: 酒鬼 Lasang Bastard by 张震岳 ayal komod


Like/Share/Follow

Feel free to comment and share your ideas below to learn together!
If you guys find this article helpful, please kindly do the writer a favor — LIKE this article./images/emoticon/emoticon12.gif


<<:  Day13:[解题技巧]Two pointers -  双指针

>>:  Day13 - 提升收入的方法

Halloween Kills线上看2021

Halloween Kills线上看2021 《月光光心慌慌:杀戮》(英语:Halloween Ki...

Day 27 : 模型解释 Shap

在经过集成式学习(ensemble learning)之後的 tree based (像是 Rand...

成熟度模型中构建安全性 (Building Security In Maturity Model :BSIMM)

CMMI、CMMC、BSIMM 和 SAMM 是评估软件开发能力的好模型。但是BSIMM 是衡量一个...

Flutter体验 Day 20-Provider

Provider Provider封装了 InheritedWidget 功能,提供更高效且易懂的使...

Day11:[资料结构]Binary Tree - 二元树

想必大家在刷leetcode时候,刷到特定的题目的时候都曾经看过这样的图片,这就是Binary t...