+ 3
Why is the split() method not working?
9 Respuestas
+ 4
Muhammad Awwal Yusuf this is a way how it can be done:
https://code.sololearn.com/W313ObfBr3j7/?ref=app
+ 1
// If you add at the end of your code
console.log (arrr);
// you will see why it is not working
// the question is what do you try to do in your code?
+ 1
Jayakrishna🇮🇳 I edited the code, check the types out, it says string and object(array) and not no
+ 1
JaScript , I want a comma separated output with a number type.
+ 1
You can do like this:
var arr = [2, 3, 7, 8];
var arrr=[];
arr.forEach(function(el) {
arrr+= el * 2 +",";
});
console.log(arrr);
// or
console.log(arrr.substr(0,arrr.length-1))
console.log(arr.join(",")) //i think, you may trying to join, not split.
hope it helps..
+ 1
Thanks JaScript ,Jayakrishna🇮🇳 😊
+ 1
Muhammad Awwal Yusuf You're welcome..
(I edited code a bit more, see again..)
0
You have single value in the array arrr!!
And you have " , " in your values so split method does not affect...
you have only numbers..
0
I just want an output that bring the no with comma