Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Two Array > Zip > Key, Value Mapping
Comments
-
Is your goal to create the map from the arrays or make the arrays from a map or what? Does this do anything you're after?
const a = [12,15,2,5]; const b = [3,5,7,9]; const count = size(a); var theMap = {}; for (var i = 0; i < count; i += 1) { theMap[a[i]] = b[i]; }
1 -
Yeah that does the job very nicely! I wasn't sure if I was misreading the API for a shorthand of it in method overloads. But this is short enough!0
-
Cool! good opportunity to write a function if this is something you need to do often.0

