开发者

Arrays in javascript, how can i learn manipulating it?

开发者 https://www.devze.com 2022-12-27 12:47 出处:网络
I\'ve read a lot about the core implementation of arrays in javascript and often I find that experimenting is the best way to learn,

I've read a lot about the core implementation of arrays in javascript and often I find that experimenting is the best way to learn,

Right now i have multiple forms where you can type in different things, i want to be able to pull the value of each one and put it in an array so that i can later on read them in in a dynamically created div.

Can anyone point me in the right direction?

There is a way I could get around this and that would be by using just one form, and pulling the text from there separated by comas (,). the thing is that i don't have the knowledge to pull the text fo开发者_运维技巧rm the form, search and find the comas, then make a new variable i think is necessary, and read that in. I know how to "think" javascript, not how to write it.

how do I learn the easiest/fastest way?


If I understand correction your question, you can use the split function to get your array from your string, here the documentation of Mozilla about it. You can also have other character than coma and use RegEx for deal with them :)

Hope it helps

example:

let text="Dog,Cat,Duck,Mouse";
let myArray=text.split(',');
0

精彩评论

暂无评论...
验证码 换一张
取 消