0
Map Symbols
function mapSymbols(N) { let alpha="!@#$%^&*"; let obj = {}; for(i=0;i<alpha.length;i++){ let chr = alpha[i]; obj[chr]=i+N; } for(let key in obj){ console.log(`${key}-${obj[key]}`); } } input = 20 desire output = !-20 @-22 #-24 $-26 %-28 ^-30 &-32 *-34 what i get !-20 @-21 #-22 $-23 %-24 ^-25 &-26 *-27 i don't understand how to increase my key value by 2 for every key
2 Réponses
0
Jay Matthews if I increase the I value it going to effect my key of the object also because it also increase with the I value
0
Yes that's r8 Jay Matthews 😊
Basically I also solve it
But I increase the value of N by 2
And then obj[chr]=I+N-2
But your ans more understandable