Convert javascript array to string

0 votes

I'm attempting to create a string out of a "value" list by iterating over it. 

This is the key:

var blkstr = $.each(value, function(idx2,val2) {                    
     var str = idx2 + ":" + val2;
     alert(str);
     return str;
}).get().join(", ");    

The alert() method operates flawlessly and displays the correct value. 

But for some reason, jQuery's.get() function fails to return the correct kind of object. 

Why am I misusing this?

Sep 23, 2022 in Java-Script by Abhinaya
• 1,160 points
323 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Java-Script

0 votes
1 answer

How to convert an Object {} to an Array [] of key-value pairs in JavaScript?

Hello @kartik, You can use Object.keys() and map() to do this var obj ...READ MORE

answered Sep 4, 2020 in Java-Script by Niroj
• 82,880 points
2,589 views
0 votes
1 answer

How to pass an array as a function parameter in JavaScript?

Hello @kartik, Use: const args = ['p0', 'p1', 'p2']; call_me.apply(this, ...READ MORE

answered Sep 4, 2020 in Java-Script by Niroj
• 82,880 points
1,493 views
0 votes
1 answer

How to convert HTML string into DOM elements?

Hello @kartik, You can use a DOMParser, like so: var ...READ MORE

answered Oct 8, 2020 in Java-Script by Niroj
• 82,880 points
7,429 views
0 votes
0 answers

Convert Array to Object

How can I convert this : ['a','b','c'] To this: { ...READ MORE

May 19, 2022 in Java-Script by Kichu
• 19,050 points
359 views
0 votes
0 answers

Java - Convert integer to string

Given a number: int number = 1234; Which would ...READ MORE

Sep 22, 2022 in Java-Script by Tejashwini
• 3,820 points
308 views
0 votes
0 answers

Convert javascript array to string

I'm attempting to loop through a "value" ...READ MORE

Sep 28, 2022 in Java by Nicholas
• 7,760 points
287 views
0 votes
0 answers

how do I create an array in jquery?

$(document).ready(function() { $("a").click(function() { ...READ MORE

Jun 6, 2022 in JQuery by Edureka
• 13,670 points
359 views
0 votes
1 answer

JQuery string contains check

In this case, we will use the includes() ...READ MORE

answered Jun 14, 2022 in JQuery by rajatha
• 7,640 points
526 views
0 votes
1 answer

JQuery string contains check

In this case, we will use the includes() ...READ MORE

answered Jun 15, 2022 in JQuery by rajatha
• 7,640 points
7,084 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP