当前位置:网站首页>let与var的区别,几个经典的小面试题
let与var的区别,几个经典的小面试题
2022-04-22 12:25:00 【云墨-款哥的博客】
试判断下面各个小题的输出结果
答案以及解释大家可以去看看我下面的一篇博客
博客地址:let和var的区别面试题答案
第一题:
console.log(dog);
var dog = "小狗"
console.log(cat);
let cat = "小猫"
第二题:
第1组
var dad = '我是爸爸!'
console.log(dad);
var dad = '我才是爸爸!'
console.log(dad);
第2组
let son = '我是儿子!'
console.log(son);
let son = '我才是儿子!'
console.log(son);
第三题
{
let a = 1;
{
// 块级作用域
let b = 2;
console.log(a);
}
console.log(b);
}
第四题
for (let i = 0; i < 3; i++) {
console.log(i);
}
console.log(i);
第五题
第1组
var monkey = '我是美猴王!';
{
console.log(monkey);
var monkey = '我是六耳猕猴';
}
console.log(monkey);
第2组
let monkey = '我是美猴王!';
{
console.log(monkey);
let monkey = '我是六耳猕猴';
}
console.log(monkey);
版权声明
本文为[云墨-款哥的博客]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_56026872/article/details/118002600
边栏推荐
- Design and implementation of house leasing system based on J2EE Rar (paper + project source code + database file)
- NER简单综述
- LeetCode 617、合并二叉树
- build 知:Makefile
- 3D应用旋转相册
- LeetCode_DFS_中等_200.岛屿数量
- CPU和GPU有什么区别?
- 论文阅读《Attention Concatenation Volume for Accurate and Efficient Stereo Matching》
- JS基础9
- After brushing a thousand multiple-choice questions, I summarized these error prone points of C language [the second bullet]
猜你喜欢

Fuzzy set theory

Read attention concatenation volume for accurate and efficient stereo matching
![[in depth understanding of tcallusdb technology] data interface description for reading the specified location in the list - [list table]](/img/ed/cccd5dee09d2f0a3e6c788bd265b36.png)
[in depth understanding of tcallusdb technology] data interface description for reading the specified location in the list - [list table]

ROS2学习笔记(十)从turtlesim学习ROS2的工作空间
![【深入理解TcaplusDB技术】批量删除列表指定位置数据接口说明——[List表]](/img/ed/cccd5dee09d2f0a3e6c788bd265b36.png)
【深入理解TcaplusDB技术】批量删除列表指定位置数据接口说明——[List表]

The fourth play of MySQL learning - detailed explanation of multi table query classification and case exercise source code

前三个月免费试用!博睿数据告警平台OneAlert火热大促进行中

电工第一讲

JS基础8
![[concurrent programming 054] multithreading status and transition process?](/img/b0/7f6bb898fb58477c73023135bd49db.png)
[concurrent programming 054] multithreading status and transition process?
随机推荐
4.21学习记录 DP记录路径(LCS)树上背包(选课)一般树形DP(没有上司的舞会)
L3-010 是否完全二叉搜索树 (30 分)
JS基础7
What role does RF chip play in mobile phone?
【并发编程053】双重检查锁的变量为什么使用volatile变量
. net treasure API: outputformatter, format output object
Difference between redis setex and set
案例4-1.4:堆中的路径 (小顶堆的模拟建立和模拟路径)
[concurrent programming 054] multithreading status and transition process?
Take you to Huawei cloud Conference [play with Huawei cloud]
【并发编程054】多线程的状态及转换过程?
前三个月免费试用!博睿数据告警平台OneAlert火热大促进行中
What is the lifecycle of automated testing?
JS基础10
机器学习 训练模板,汇总多个分类器
订货系统打破批发企业瓶颈期,助力企业数字化转型
ThreadLocal
ONT和ONU
【并发编程055】如下守护线程是否会执行finally模块中的代码?
redis 不能添加数据