嗨,我想按对象转换为数组,但我不知道该怎么做。
对象
{ stops: [ 'Route1', 'Route2' ], time: [ '12:00 am', '12:30 am', '01:00 am', '01:30 am', '02:00 am' ], _id: 5c636357bc92ec0e44a44946}
如何解析time: [ '12:00 am', '12:30 am', '01:00 am', '01:30 am', '02:00 am' ]
,就像这样。
数组
[ '12:00 am', '12:30 am', '01:00 am', '01:30 am', '02:00 am' ]
答案 0 :(得分:0)
使用。访问时间属性的符号
var obj={ stops: [ 'Route1', 'Route2' ], time: [ '12:00 am', '12:30 am', '01:00 am', '01:30 am', '02:00 am' ], _id: '5c636357bc92ec0e44a44946'}
console.log(obj.time)
答案 1 :(得分:0)
用于将所有内容转换为数组
ReadInteger proc
TryAgain:
call _getchar ; read input from stdin; return result in EAX
cmp eax, 48 ; \ if (input < '0')
jl TryAgain ; / jump to TryAgain
cmp eax, 57 ; \ if (input > '9')
jg TryAgain ; / jump to TryAgain
sub eax, 48 ; input -= '0'
ret
ReadInteger endp
multi proc
push esi
push ebx
push edi
call ReadInteger
mov esi, eax
call ReadInteger
mov ebx, eax
call ReadInteger
mov edi, eax
call ReadInteger
add eax, esi
add eax, ebx
sub eax, edi
mul ebx
mov [foo], eax
pop edi
pop ebx
pop esi
ret
multi endp
如果您只想转换时间属性,那么
ReadConsoleInput