var j1 = {
'j11': 'a',
'j12': 'b',
'j13': 'c',
};
var j2 = {
'n1': 'j1',
'n2': 'j2',
};
var obj = {
j1: j1
};
var x = 'n1';
console.log(j2[x]['j11']);//undefined
console.log(obj[j2[x]]['j11']);// a
// ? 如何直接通过对象名同名字符串来获取对象 ?
js-对象名是一个变量时,-怎么获取当前对象
TOC
Recent Posts
Tags
- apache 4
- axios 1
- benchmark 1
- c 1
- canvas 1
- centos 3
- channel 1
- crontab 1
- css 2
- docker 4
- fail2ban 1
- frp 1
- gin 1
- github 1
- go 26
- goaccess 1
- goroutine 1
- http 1
- https 1
- jetbrains 1
- jquery 1
- js 2
- linux 20
- mermaid 1
- mysql 10
- nginx 3
- node 1
- php 43
- prisma 1
- react 8
- server 1
- ssh 2
- tarojs 1
- tcp/ip 1
- token 1
- ubuntu 1
- ufw 1
- unit-test 1
- vmware 1
- vscode 1
- vue 12
- yum 1
- 域名 3
- 安全 2
- 微信 3
- 算法 3