2021年7月18日星期日

【前端】JavaScript学习笔记(四)——面向对象编程

✨课程链接

【狂神说Java】JavaScript最新教程通俗易懂_哔哩哔哩_bilibili


✨学习笔记

内部对象

Date

var date = new Date();date.getFullYear()date.getMonth() // 0-11date.getDate()date.getDay() // 星期几date.getHours()date.getMinutes()date.getSeconds()date.getTime() // 时间戳console.log(new Date(date.getTime()))console.log(date.toLocaleString())

JSON

var user = { name:"user", age:"3",}var jsonUser = JSON.stringify(user);console.log(jsonUser)var stringUser = JSON.parse('{"name":"user","age":"3"}')console.log(stringUser)

Ajax

  • 原生js写法 xhr异步请求
  • JQuery封装好的方法 $("#name").ajax("")
  • axios请求

原型对象

<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title></head> <script>  var Student = {   name:"student",   age:"3",   run:function () {    console.log(this.name + " run...")   }  }  var temp = {   name:"temp"  }  temp.__proto__ = user  temp.run() </script><body></body></html>

class继承

<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <script>  function Student(name){   this.name = name  }  // 新增方法  Student.prototype.hello = function () {   alert("Hello")  }  // ES6 之后  // 定义一个Student类  class Student{   constructor(name) {    this.name = name   }   hello(){    alert(......

原文转载:http://www.shaoqun.com/a/887581.html

跨境电商:https://www.ikjzd.com/

邮政电话:https://www.ikjzd.com/w/202

amazon go:https://www.ikjzd.com/w/67

patpat:https://www.ikjzd.com/w/1079


✨课程链接【狂神说Java】JavaScript最新教程通俗易懂_哔哩哔哩_bilibili✨学习笔记内部对象Datevardate=newDate();date.getFullYear()date.getMonth()//0-11date.getDate()date.getDay()//星期几date.getHours()date.getMinutes()date.getSeconds()dat
vat:https://www.ikjzd.com/w/109
盛夏游玩欲饥渴难耐 西樵山国艺暑期帮解渴:http://www.30bags.com/a/417995.html
嵊泗东海谣错觉创意馆好玩吗?简介一下怎么样啊:http://www.30bags.com/a/247485.html
嵊泗东海谣错觉创意馆门票多少钱?团购票价优惠吗:http://www.30bags.com/a/247484.html
嵊泗东海谣错觉创意馆营业时间?开放时间:http://www.30bags.com/a/247483.html
第一次和姐姐偷尝禁果的真实经历:http://lady.shaoqun.com/m/a/108201.html
公么吃奶摸下面非常好 强壮的公么征服我厨房:http://lady.shaoqun.com/m/a/247964.html
男友拉我的手进他裤子 腿张开给我看看你下面:http://lady.shaoqun.com/m/a/247453.html
女性做爱时呻吟的科学解释:http://lady.shaoqun.com/a/424248.html
古人教你如何对付拜金女:http://lady.shaoqun.com/a/424249.html
女粉丝遇到邓超疯狂喘气呻吟的场景,被封为"高潮女":http://lady.shaoqun.com/a/424250.html
花和尚教你15分钟搞定优质女人:http://lady.shaoqun.com/a/424251.html

没有评论:

发表评论