javascript Javascript介绍

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Javascript介绍相关的知识,希望对你有一定的参考价值。

airbnb style guide https://travishorn.com/setting-up-eslint-on-vs-code-with-airbnb-javascript-style-guide-6eb78a535ba6

name = 'chris' (makes name global)

var name = 'chris' (var deprecated, in ES6, now use let)

const name = 'chris'

const for arrays and objects can still be updated, however

hashes are called objects in JS

IF statements

if (something > 18) {
  console.log("yay");
}
else if (blah) {
}

double equals (loose comparison) convert type before comparison, use triple equals for strict comparison

parseInt("1")

(1).toString()

interpolation:

`hello $(name)` (use backticks)


variables are blocked scoped, e.g.:

      const students = []
      
      for (let i = 0; i < 3; i++) {
        let a_student = {}
        a_student["name"] = prompt("What is your name?");
        a_student["age"] = prompt("What is your age?");
        students.push(a_student);
      }

      console.log(students)
      
need to have let a_student defined inside the for loop

function sayHello () {
  console.log("Hello");
}

calling sayHello will pass the entire function, calling sayHello() will actually execute it

以上是关于javascript Javascript介绍的主要内容,如果未能解决你的问题,请参考以下文章

javascript Javascript介绍

javaScript介绍

JavaScript 介绍

《javascript高级程序设计》读书笔记javascript简单介绍

javascript介绍

javascript标签语句简单介绍