Can't perform any operations over object in javascript The 2019 Stack Overflow Developer Survey Results Are InLength of a JavaScript objectWhat is the most efficient way to deep clone an object in JavaScript?How do I remove a property from a JavaScript object?How do I check if an array includes an object in JavaScript?Which equals operator (== vs ===) should be used in JavaScript comparisons?How do I test for an empty JavaScript object?How do I correctly clone a JavaScript object?What is the !! (not not) operator in JavaScript?Checking if a key exists in a JavaScript object?How to use foreach with array in JavaScript?

Worn-tile Scrabble

Am I thawing this London Broil safely?

Output the Arecibo Message

Why is the maximum length of OpenWrt’s root password 8 characters?

Why do UK politicians seemingly ignore opinion polls on Brexit?

What do hard-Brexiteers want with respect to the Irish border?

Protecting Dualbooting Windows from dangerous code (like rm -rf)

When should I buy a clipper card after flying to OAK?

Why do we hear so much about the Trump administration deciding to impose and then remove tariffs?

Loose spokes after only a few rides

Why didn't the Event Horizon Telescope team mention Sagittarius A*?

If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?

What is the accessibility of a package's `Private` context variables?

Can a rogue use sneak attack with weapons that have the thrown property even if they are not thrown?

What do the Banks children have against barley water?

Return to UK after being refused entry years previously

How to manage monthly salary

Did 3000BC Egyptians use meteoric iron weapons?

Lightning Grid - Columns and Rows?

Is three citations per paragraph excessive for undergraduate research paper?

Resizing object distorts it (Illustrator CC 2018)

Shouldn't "much" here be used instead of "more"?

How to save as into a customized destination on macOS?

Can you compress metal and what would be the consequences?



Can't perform any operations over object in javascript



The 2019 Stack Overflow Developer Survey Results Are InLength of a JavaScript objectWhat is the most efficient way to deep clone an object in JavaScript?How do I remove a property from a JavaScript object?How do I check if an array includes an object in JavaScript?Which equals operator (== vs ===) should be used in JavaScript comparisons?How do I test for an empty JavaScript object?How do I correctly clone a JavaScript object?What is the !! (not not) operator in JavaScript?Checking if a key exists in a JavaScript object?How to use foreach with array in JavaScript?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have two functions as given below. getRawData() and getBTRawData()



  1. getBTRawData() just gets the data from Bluetooth from a phone

  2. getRawData() gets the return value from getBTRawData() and tries to iterate over but that doesn't seem to work. I'm able to print the value inside a promise but I can't perform any functions on it.




getRawData() 

const result = this.getBTRawData().then((item) =>
console.log("Item in this one: ", item);
let flatten = [];
for(let i in item)
console.log("something here");
flatten.push(...item[i]);


console.log(flatten);

).catch(err =>
console.log(err);
);



async getBTRawData()
let result = [];
const res = await this.bluetoothSerial.subscribeRawData().subscribe((data) =>
//console.log("raw data");
// console.log(data);
var buffer = new Uint8Array(data);
//this.raw_data_c.push(buffer);
result.push(buffer);
//console.log(this.raw_data_c);).map(
// console.log(result);
);

return result;





Any help is greatly appreciated. Thank you.










share|improve this question
























  • Not sure what could be going wrong...I stubbed getBTRawData to resolve to an array of Uint8Array's and getBTRawData worked fine

    – brian-lives-outdoors
    Mar 22 at 4:15











  • yea, getBTRawData does return an array of Uint8Arrays but I can't loop over the result, which I don't understand why

    – Abubakar Saad
    Mar 22 at 4:23











  • What happens? Can you see that item is an array of Uint8Arrays in the then callback? (Does your console.log("Item in this one: ", item); print anything?)

    – brian-lives-outdoors
    Mar 22 at 4:25











  • (oh, and my bad...I meant to say getRawData worked fine in my first comment)

    – brian-lives-outdoors
    Mar 22 at 4:28











  • yea, it prints Array of Uint8Arrays but I can't seem to loop over. The loop won't execute at all.

    – Abubakar Saad
    Mar 22 at 4:30

















0















I have two functions as given below. getRawData() and getBTRawData()



  1. getBTRawData() just gets the data from Bluetooth from a phone

  2. getRawData() gets the return value from getBTRawData() and tries to iterate over but that doesn't seem to work. I'm able to print the value inside a promise but I can't perform any functions on it.




getRawData() 

const result = this.getBTRawData().then((item) =>
console.log("Item in this one: ", item);
let flatten = [];
for(let i in item)
console.log("something here");
flatten.push(...item[i]);


console.log(flatten);

).catch(err =>
console.log(err);
);



async getBTRawData()
let result = [];
const res = await this.bluetoothSerial.subscribeRawData().subscribe((data) =>
//console.log("raw data");
// console.log(data);
var buffer = new Uint8Array(data);
//this.raw_data_c.push(buffer);
result.push(buffer);
//console.log(this.raw_data_c);).map(
// console.log(result);
);

return result;





Any help is greatly appreciated. Thank you.










share|improve this question
























  • Not sure what could be going wrong...I stubbed getBTRawData to resolve to an array of Uint8Array's and getBTRawData worked fine

    – brian-lives-outdoors
    Mar 22 at 4:15











  • yea, getBTRawData does return an array of Uint8Arrays but I can't loop over the result, which I don't understand why

    – Abubakar Saad
    Mar 22 at 4:23











  • What happens? Can you see that item is an array of Uint8Arrays in the then callback? (Does your console.log("Item in this one: ", item); print anything?)

    – brian-lives-outdoors
    Mar 22 at 4:25











  • (oh, and my bad...I meant to say getRawData worked fine in my first comment)

    – brian-lives-outdoors
    Mar 22 at 4:28











  • yea, it prints Array of Uint8Arrays but I can't seem to loop over. The loop won't execute at all.

    – Abubakar Saad
    Mar 22 at 4:30













0












0








0








I have two functions as given below. getRawData() and getBTRawData()



  1. getBTRawData() just gets the data from Bluetooth from a phone

  2. getRawData() gets the return value from getBTRawData() and tries to iterate over but that doesn't seem to work. I'm able to print the value inside a promise but I can't perform any functions on it.




getRawData() 

const result = this.getBTRawData().then((item) =>
console.log("Item in this one: ", item);
let flatten = [];
for(let i in item)
console.log("something here");
flatten.push(...item[i]);


console.log(flatten);

).catch(err =>
console.log(err);
);



async getBTRawData()
let result = [];
const res = await this.bluetoothSerial.subscribeRawData().subscribe((data) =>
//console.log("raw data");
// console.log(data);
var buffer = new Uint8Array(data);
//this.raw_data_c.push(buffer);
result.push(buffer);
//console.log(this.raw_data_c);).map(
// console.log(result);
);

return result;





Any help is greatly appreciated. Thank you.










share|improve this question
















I have two functions as given below. getRawData() and getBTRawData()



  1. getBTRawData() just gets the data from Bluetooth from a phone

  2. getRawData() gets the return value from getBTRawData() and tries to iterate over but that doesn't seem to work. I'm able to print the value inside a promise but I can't perform any functions on it.




getRawData() 

const result = this.getBTRawData().then((item) =>
console.log("Item in this one: ", item);
let flatten = [];
for(let i in item)
console.log("something here");
flatten.push(...item[i]);


console.log(flatten);

).catch(err =>
console.log(err);
);



async getBTRawData()
let result = [];
const res = await this.bluetoothSerial.subscribeRawData().subscribe((data) =>
//console.log("raw data");
// console.log(data);
var buffer = new Uint8Array(data);
//this.raw_data_c.push(buffer);
result.push(buffer);
//console.log(this.raw_data_c);).map(
// console.log(result);
);

return result;





Any help is greatly appreciated. Thank you.






getRawData() 

const result = this.getBTRawData().then((item) =>
console.log("Item in this one: ", item);
let flatten = [];
for(let i in item)
console.log("something here");
flatten.push(...item[i]);


console.log(flatten);

).catch(err =>
console.log(err);
);



async getBTRawData()
let result = [];
const res = await this.bluetoothSerial.subscribeRawData().subscribe((data) =>
//console.log("raw data");
// console.log(data);
var buffer = new Uint8Array(data);
//this.raw_data_c.push(buffer);
result.push(buffer);
//console.log(this.raw_data_c);).map(
// console.log(result);
);

return result;





getRawData() 

const result = this.getBTRawData().then((item) =>
console.log("Item in this one: ", item);
let flatten = [];
for(let i in item)
console.log("something here");
flatten.push(...item[i]);


console.log(flatten);

).catch(err =>
console.log(err);
);



async getBTRawData()
let result = [];
const res = await this.bluetoothSerial.subscribeRawData().subscribe((data) =>
//console.log("raw data");
// console.log(data);
var buffer = new Uint8Array(data);
//this.raw_data_c.push(buffer);
result.push(buffer);
//console.log(this.raw_data_c);).map(
// console.log(result);
);

return result;






javascript angular typescript bluetooth rxjs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 3:46







Abubakar Saad

















asked Mar 22 at 3:39









Abubakar SaadAbubakar Saad

73110




73110












  • Not sure what could be going wrong...I stubbed getBTRawData to resolve to an array of Uint8Array's and getBTRawData worked fine

    – brian-lives-outdoors
    Mar 22 at 4:15











  • yea, getBTRawData does return an array of Uint8Arrays but I can't loop over the result, which I don't understand why

    – Abubakar Saad
    Mar 22 at 4:23











  • What happens? Can you see that item is an array of Uint8Arrays in the then callback? (Does your console.log("Item in this one: ", item); print anything?)

    – brian-lives-outdoors
    Mar 22 at 4:25











  • (oh, and my bad...I meant to say getRawData worked fine in my first comment)

    – brian-lives-outdoors
    Mar 22 at 4:28











  • yea, it prints Array of Uint8Arrays but I can't seem to loop over. The loop won't execute at all.

    – Abubakar Saad
    Mar 22 at 4:30

















  • Not sure what could be going wrong...I stubbed getBTRawData to resolve to an array of Uint8Array's and getBTRawData worked fine

    – brian-lives-outdoors
    Mar 22 at 4:15











  • yea, getBTRawData does return an array of Uint8Arrays but I can't loop over the result, which I don't understand why

    – Abubakar Saad
    Mar 22 at 4:23











  • What happens? Can you see that item is an array of Uint8Arrays in the then callback? (Does your console.log("Item in this one: ", item); print anything?)

    – brian-lives-outdoors
    Mar 22 at 4:25











  • (oh, and my bad...I meant to say getRawData worked fine in my first comment)

    – brian-lives-outdoors
    Mar 22 at 4:28











  • yea, it prints Array of Uint8Arrays but I can't seem to loop over. The loop won't execute at all.

    – Abubakar Saad
    Mar 22 at 4:30
















Not sure what could be going wrong...I stubbed getBTRawData to resolve to an array of Uint8Array's and getBTRawData worked fine

– brian-lives-outdoors
Mar 22 at 4:15





Not sure what could be going wrong...I stubbed getBTRawData to resolve to an array of Uint8Array's and getBTRawData worked fine

– brian-lives-outdoors
Mar 22 at 4:15













yea, getBTRawData does return an array of Uint8Arrays but I can't loop over the result, which I don't understand why

– Abubakar Saad
Mar 22 at 4:23





yea, getBTRawData does return an array of Uint8Arrays but I can't loop over the result, which I don't understand why

– Abubakar Saad
Mar 22 at 4:23













What happens? Can you see that item is an array of Uint8Arrays in the then callback? (Does your console.log("Item in this one: ", item); print anything?)

– brian-lives-outdoors
Mar 22 at 4:25





What happens? Can you see that item is an array of Uint8Arrays in the then callback? (Does your console.log("Item in this one: ", item); print anything?)

– brian-lives-outdoors
Mar 22 at 4:25













(oh, and my bad...I meant to say getRawData worked fine in my first comment)

– brian-lives-outdoors
Mar 22 at 4:28





(oh, and my bad...I meant to say getRawData worked fine in my first comment)

– brian-lives-outdoors
Mar 22 at 4:28













yea, it prints Array of Uint8Arrays but I can't seem to loop over. The loop won't execute at all.

– Abubakar Saad
Mar 22 at 4:30





yea, it prints Array of Uint8Arrays but I can't seem to loop over. The loop won't execute at all.

– Abubakar Saad
Mar 22 at 4:30












1 Answer
1






active

oldest

votes


















0














getBTRawData seems to be returning an array, not a Promise. You should be able to directly work with the data from getBTRawData inside getRawData (assuming everything else works).






share|improve this answer























  • I've changed that but when I try to flatten it, it returns empty array and console for the result becomes object: __zone_symbol__state: true __zone_symbol__value: Array(52) 0: Uint8Array [84] 1: Uint8Array(5) [82, 85, 69, 13, 10]

    – Abubakar Saad
    Mar 22 at 4:27











  • It seems like you just need to get rid of those __zone_symbol__* keys in the object and then you should be able to iterate over it

    – miyu
    Mar 22 at 4:36











  • but ____zone_symbol__* is basically indicating its promise, right?

    – Abubakar Saad
    Mar 22 at 4:38












  • Not too sure about the details of your bluetooth library, so you might be right in which case I don't really know whats happening, sorry! If you print the data in __zone_symbol__value is it what you expect at least?

    – miyu
    Mar 22 at 4:45











  • No worries, thanks for the help. Yes, the data is exactly what I expect.

    – Abubakar Saad
    Mar 22 at 4:49











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55292546%2fcant-perform-any-operations-over-object-in-javascript%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














getBTRawData seems to be returning an array, not a Promise. You should be able to directly work with the data from getBTRawData inside getRawData (assuming everything else works).






share|improve this answer























  • I've changed that but when I try to flatten it, it returns empty array and console for the result becomes object: __zone_symbol__state: true __zone_symbol__value: Array(52) 0: Uint8Array [84] 1: Uint8Array(5) [82, 85, 69, 13, 10]

    – Abubakar Saad
    Mar 22 at 4:27











  • It seems like you just need to get rid of those __zone_symbol__* keys in the object and then you should be able to iterate over it

    – miyu
    Mar 22 at 4:36











  • but ____zone_symbol__* is basically indicating its promise, right?

    – Abubakar Saad
    Mar 22 at 4:38












  • Not too sure about the details of your bluetooth library, so you might be right in which case I don't really know whats happening, sorry! If you print the data in __zone_symbol__value is it what you expect at least?

    – miyu
    Mar 22 at 4:45











  • No worries, thanks for the help. Yes, the data is exactly what I expect.

    – Abubakar Saad
    Mar 22 at 4:49















0














getBTRawData seems to be returning an array, not a Promise. You should be able to directly work with the data from getBTRawData inside getRawData (assuming everything else works).






share|improve this answer























  • I've changed that but when I try to flatten it, it returns empty array and console for the result becomes object: __zone_symbol__state: true __zone_symbol__value: Array(52) 0: Uint8Array [84] 1: Uint8Array(5) [82, 85, 69, 13, 10]

    – Abubakar Saad
    Mar 22 at 4:27











  • It seems like you just need to get rid of those __zone_symbol__* keys in the object and then you should be able to iterate over it

    – miyu
    Mar 22 at 4:36











  • but ____zone_symbol__* is basically indicating its promise, right?

    – Abubakar Saad
    Mar 22 at 4:38












  • Not too sure about the details of your bluetooth library, so you might be right in which case I don't really know whats happening, sorry! If you print the data in __zone_symbol__value is it what you expect at least?

    – miyu
    Mar 22 at 4:45











  • No worries, thanks for the help. Yes, the data is exactly what I expect.

    – Abubakar Saad
    Mar 22 at 4:49













0












0








0







getBTRawData seems to be returning an array, not a Promise. You should be able to directly work with the data from getBTRawData inside getRawData (assuming everything else works).






share|improve this answer













getBTRawData seems to be returning an array, not a Promise. You should be able to directly work with the data from getBTRawData inside getRawData (assuming everything else works).







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 22 at 3:47









miyumiyu

2347




2347












  • I've changed that but when I try to flatten it, it returns empty array and console for the result becomes object: __zone_symbol__state: true __zone_symbol__value: Array(52) 0: Uint8Array [84] 1: Uint8Array(5) [82, 85, 69, 13, 10]

    – Abubakar Saad
    Mar 22 at 4:27











  • It seems like you just need to get rid of those __zone_symbol__* keys in the object and then you should be able to iterate over it

    – miyu
    Mar 22 at 4:36











  • but ____zone_symbol__* is basically indicating its promise, right?

    – Abubakar Saad
    Mar 22 at 4:38












  • Not too sure about the details of your bluetooth library, so you might be right in which case I don't really know whats happening, sorry! If you print the data in __zone_symbol__value is it what you expect at least?

    – miyu
    Mar 22 at 4:45











  • No worries, thanks for the help. Yes, the data is exactly what I expect.

    – Abubakar Saad
    Mar 22 at 4:49

















  • I've changed that but when I try to flatten it, it returns empty array and console for the result becomes object: __zone_symbol__state: true __zone_symbol__value: Array(52) 0: Uint8Array [84] 1: Uint8Array(5) [82, 85, 69, 13, 10]

    – Abubakar Saad
    Mar 22 at 4:27











  • It seems like you just need to get rid of those __zone_symbol__* keys in the object and then you should be able to iterate over it

    – miyu
    Mar 22 at 4:36











  • but ____zone_symbol__* is basically indicating its promise, right?

    – Abubakar Saad
    Mar 22 at 4:38












  • Not too sure about the details of your bluetooth library, so you might be right in which case I don't really know whats happening, sorry! If you print the data in __zone_symbol__value is it what you expect at least?

    – miyu
    Mar 22 at 4:45











  • No worries, thanks for the help. Yes, the data is exactly what I expect.

    – Abubakar Saad
    Mar 22 at 4:49
















I've changed that but when I try to flatten it, it returns empty array and console for the result becomes object: __zone_symbol__state: true __zone_symbol__value: Array(52) 0: Uint8Array [84] 1: Uint8Array(5) [82, 85, 69, 13, 10]

– Abubakar Saad
Mar 22 at 4:27





I've changed that but when I try to flatten it, it returns empty array and console for the result becomes object: __zone_symbol__state: true __zone_symbol__value: Array(52) 0: Uint8Array [84] 1: Uint8Array(5) [82, 85, 69, 13, 10]

– Abubakar Saad
Mar 22 at 4:27













It seems like you just need to get rid of those __zone_symbol__* keys in the object and then you should be able to iterate over it

– miyu
Mar 22 at 4:36





It seems like you just need to get rid of those __zone_symbol__* keys in the object and then you should be able to iterate over it

– miyu
Mar 22 at 4:36













but ____zone_symbol__* is basically indicating its promise, right?

– Abubakar Saad
Mar 22 at 4:38






but ____zone_symbol__* is basically indicating its promise, right?

– Abubakar Saad
Mar 22 at 4:38














Not too sure about the details of your bluetooth library, so you might be right in which case I don't really know whats happening, sorry! If you print the data in __zone_symbol__value is it what you expect at least?

– miyu
Mar 22 at 4:45





Not too sure about the details of your bluetooth library, so you might be right in which case I don't really know whats happening, sorry! If you print the data in __zone_symbol__value is it what you expect at least?

– miyu
Mar 22 at 4:45













No worries, thanks for the help. Yes, the data is exactly what I expect.

– Abubakar Saad
Mar 22 at 4:49





No worries, thanks for the help. Yes, the data is exactly what I expect.

– Abubakar Saad
Mar 22 at 4:49



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55292546%2fcant-perform-any-operations-over-object-in-javascript%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해