Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Technique[技术] by (71.8m points)

i can see the data is an array but javascript typeof shows it's an object and can't extract data

i have a simple question from javascript guru's out there which i appreciate if you can help me with it.since i am new to javascript i am stuck doing a simple task.i need to extract data from an array like this

    [com.stardust.automator.UiObject@44a407; boundsInParent: Rect(-20, 1 - 374, 77); boundsInScreen: Rect(0, 6150 - 1083, 2249); packageName: com.android.chrome; className: android.view.View; text: Подписаться на пользователя LovNpleasure 0.08 ; contentDescription: null; viewId: null; checkable: false; checked: false; focusable: false; focused: false; selected: false; clickable: true; longClickable: false; enabled: true; password: false; scrollable: false; [ACTION_CLICK, ACTION_LONG_CLICK, ACTION_ACCESSIBILITY_FOCUS, ACTION_NEXT_AT_MOVEMENT_GRANULARITY, ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, ACTION_NEXT_HTML_ELEMENT, ACTION_PREVIOUS_HTML_ELEMENT],
 com.stardust.automator.UiObject@44a654; boundsInParent: Rect(32, 6 - 59, 22); boundsInScreen: Rect(739, 6232 - 814, 2249); packageName: com.android.chrome; className: android.widget.TextView; text: 0.08 ; contentDescription: null; viewId: null; checkable: false; checked: false; focusable: false; focused: false; selected: false; clickable: false; longClickable: false; enabled: true; password: false; scrollable: false; [ACTION_LONG_CLICK, ACTION_ACCESSIBILITY_FOCUS, ACTION_NEXT_AT_MOVEMENT_GRANULARITY, ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, ACTION_NEXT_HTML_ELEMENT, ACTION_PREVIOUS_HTML_ELEMENT]]

whenever i use this code (typeof clickableitems) i can see in console that the type of this data is an object but i can see that this array is started with [ and not { so how is it the data is an object i don't know.i realy don't mind now the type of object since i searched in internet and i know how to find out what is the true type of object (array or object) but what i am looking for is how to extract the second part of this array.i used clickableitems[1] and it returned me error i used clickableitems[0] and still same and i recieved error.so if you guys know there is a way to extract this data from this array i appreciate if you help me with it


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...