From 2fedd0692f940a6fa82f327e577e2e7a863d71a7 Mon Sep 17 00:00:00 2001 From: 8ga Date: Tue, 29 Apr 2025 12:30:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Web=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E9=9D=A2=E8=AF=95=E9=A2=98.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Web前端面试题.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Web前端面试题.md diff --git a/Web前端面试题.md b/Web前端面试题.md new file mode 100644 index 0000000..10290f0 --- /dev/null +++ b/Web前端面试题.md @@ -0,0 +1,23 @@ +## v-if和v-show的区别,分别适合什么场景 + +v-if 操作的实际上是 dom 元素的创建或销毁。v-show 操作的是display:none/block属性。频繁地切换使用 v-show,否则使用 v-if。 + +## async await 关键字的用途 + +async await 是es7里面的新语法,async 用于声明一个异步函数,await 阻塞等待一个异步方法执行完成。 + +## Cookie 、LocalStorage 、 SessionStrorage的区别 + +- Cookie 是 http 协议的组成部分,会在同源 http 请求中携带,数据根据不同浏览器限制,大小一般不能超过4k +- LocalStorage 和 SessionStrorage 仅会持久化存储,大小一般是5M + +## this 的指向有哪些 + +1、普通函数中的 this 指向 window +2、定时器中的 this 指向 window +3、箭头函数没有 this,它的 this 指向取决于外部环境 +4、事件中的 this 指向事件的调用者 黑马程序员 +5、构造函数中 this 和原型对象中的 this,都是指向构造函数 new 出来实例对象 +6、class 中的 this 指向由 constructor 构造器 new 出来的实例对象 +7、自调用函数中的 this 指向 window +