Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以下输出将是什么以及为什么
let user = "Brienne of Tarth"; "Sansa Stark"; "Lyanna Mormont";chrome 打印最后一个,当我访问用户时,它显示第一个。为什么会发生
let user = "Brienne of Tarth"; "Sansa Stark"; "Lyanna Mormont";
在典型的 REPL(read-eval-print 循环)中,被打印的东西只是执行的最后一条语句的评估结果。你有三个陈述:
第一个是变量赋值,后两个只是字符串表达式,它们自己什么都不做,但仍然是有效的语句。
如果你把它放在控制台中,Chrome 只会打印最后一条语句的值(“Lyanna Mormont”)。