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 in Java-Script by Abhinaya
• 1,160 points
49 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,800 points
1,931 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,800 points
856 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,800 points
5,724 views
0 votes
0 answers

Convert Array to Object

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

May 19 in Java-Script by Kichu
• 19,040 points
55 views
0 votes
0 answers

Java - Convert integer to string

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

Sep 22 in Java-Script by Tejashwini
• 2,860 points
53 views
0 votes
0 answers

Convert javascript array to string

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

Sep 28 in Java by Nicholas
• 7,120 points
53 views
0 votes
0 answers

how do I create an array in jquery?

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

Jun 6 in JQuery by Edureka
• 13,640 points
104 views
0 votes
1 answer

JQuery string contains check

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

answered Jun 14 in JQuery by rajatha
• 7,480 points
111 views
0 votes
1 answer

JQuery string contains check

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

answered Jun 15 in JQuery by rajatha
• 7,480 points
769 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