将参数添加到原数组末尾,并返回数组的长度
将参数添加到原数组开头,并返回数组的长度
if(){
}else if(){
}else{
}
for(var i = 0; i< 10; i++){
if(i==10) {
break; 中止循环
}
if(i==5) {
continue; 跳出本次循环
}
}
document.getElementById("demo")
console.log('hello word');
while (条件)
{
需要执行的代码
}
do
{
x=x + "The number is " + i + "
";
i++;
}
while (i<5);
setInterval(function(){alert("Hello")},3000);
document.getElementByTagName("div")
document.getElementByClassName("header")
obj.getAttrbute("title")
obj.setAttrbute("title","流星雨")
element.childNodes
document.body.nodeType
childNodes[0].nodeValue
childNodes[0].nodeValue == childNodes.firstChild.nodeValue
node.lastChild
let foo = ["a","b","c"]
let [a,b] = foo; // a = "a" ; b = "b"
class A{
constructor(name,age){
this.name = name;
this.age = age
}
}
//
class B extends A{
constructor(){
// 子类必须在constructor 中指定super 函数
// 如果没有置顶constructor 默认带super的函数的constructor 将会被添加
super("lxy",25)
}
}
export const a = "123"
export default {
}
import A from "a" // a.js
let c = "c"
let b = `ab ${a}` // abc
const a = "a"
const b = "b"
const c = {
a:a
b:b
}
// 简写
const c = {
a,
b
}
let req = new Promise((resolve,reject)=>{
setTimeout(resolve,1000)
})
req.then(res => {
console.log(res)
})
if(arr.includes(x)){
}
async login(){
const user = await get_user();
}
this.login();
const obj = {a:1,b:2,c:3}
console.log(Object.values(obj1)); // [1,2,3]
for (let [key,value] of Object.entires(obj)){
console.log(`key:${key},value:${value}`)
}