本文介绍了带有“ const”的怪异JavaScript代码约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
javascript中的这段代码约定是什么?
What is this code convention in javascript?
const {导航} = //什么
从什么意义上讲。我在RNs React导航中看到了
As in, what sense does it make. I saw it in RNs React navigation
推荐答案
它被称为解构。当您有一个对象并且只想使用该对象的属性时,可以使用该约定仅获取它。
It's named destructuring. When you have an object and you want to take only a property of that object, you can get only it by using that convention.
let fullName = {
first: 'John',
last: 'Smith'
}
const { first } = fullName;
您可以在此处查看更多信息
You can take a look here for more info's
这篇关于带有“ const”的怪异JavaScript代码约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!