当前位置: 首页 > news >正文

前端学习日记(十)

一.课程学习

构造函数

<script>function Person() {this.name = '佚名'// 设置名字this.setName = function (name) {this.name = name}// 读取名字this.getName = () => {console.log(this.name)}}// 实例对像,获得了构造函数中封装的所有逻辑let p1 = new Person()p1.setName('小明')console.log(p1.name)// 实例对象let p2 = new Person()console.log(p2.name)
</script>

原型对象

constructor

对象原型

原型继承

<body><script>// 继续抽取   公共的部分放到原型上// const Person1 = {//   eyes: 2,//   head: 1// }// const Person2 = {//   eyes: 2,//   head: 1// }// 构造函数  new 出来的对象 结构一样,但是对象不一样function Person() {this.eyes = 2this.head = 1}// console.log(new Person)// 女人  构造函数   继承  想要 继承 Personfunction Woman() {}// Woman 通过原型来继承 Person// 父构造函数(父类)   子构造函数(子类)// 子类的原型 =  new 父类  Woman.prototype = new Person()   // {eyes: 2, head: 1} // 指回原来的构造函数Woman.prototype.constructor = Woman// 给女人添加一个方法  生孩子Woman.prototype.baby = function () {console.log('宝贝')}const red = new Woman()console.log(red)// console.log(Woman.prototype)// 男人 构造函数  继承  想要 继承 Personfunction Man() {}// 通过 原型继承 PersonMan.prototype = new Person()Man.prototype.constructor = Manconst pink = new Man()console.log(pink)</script>
</body>

二.环境搭建

学习git

一文带你学会Git的基本使用⭐⭐⭐(超简洁,避免冗余)-CSDN博客

nodejs的环境变量有一些问题,还没弄好

http://www.lryc.cn/news/596624.html

相关文章:

  • 【专题十三】队列 +宽搜
  • 3.5 模块化编程实践
  • 秋招Day17 - Spring - 事务
  • 使用 Ansys Fluent 软件参数化工作流程对搅拌罐中的稳态涡流进行仿真
  • 力扣 78.子集
  • ros0基础-day17
  • 电商项目_秒杀_架构及核心
  • Linux文件系统深入理解
  • 交叉编译opencv(Cpp)于arm64架构开发板上
  • 决策规划内容整理
  • 三轴云台之图像处理算法篇
  • 跨越语言壁垒!ZKmall开源商城多语言架构如何支撑电商全球化布局
  • Ext4文件系统全景解析
  • C++基础学习——文件操作详解
  • wangEditor5添加键盘事件/实现定时保存功能
  • 单张显卡运行多个vllm模型
  • 进程优先级切换调度-进程概念(6)
  • 【C++】继承和多态扩展学习
  • PyQt5在Pycharm上的环境搭建 -- Qt Designer + Pyuic + Pyrcc组合,大幅提升GUI开发效率
  • Qt多语言支持初步探索
  • 按键精灵脚本:自动化利刃的双面性 - 从技术原理到深度实践与反思
  • Web3面试题
  • 拥抱区块链红利:机遇无限,风险暗涌
  • 期权分红怎么分的?
  • UNet改进(24):注意力机制-从基础原理到高级融合策略
  • Atcoder Beginner Contest 415 D题
  • 算法笔记之堆排序
  • 2023CCPC秦皇岛 F. Mystery of Prime(线性DP)
  • Python通关秘籍(四)数据结构——列表
  • iView Table组件二次封装