๐๐ฐ๐ณ ๐ต๐ฉ๐ช๐ด ๐ข๐ด๐ด๐ช๐จ๐ฏ๐ฎ๐ฆ๐ฏ๐ต, ๐ค๐ณ๐ฆ๐ข๐ต๐ฆ ๐ข ๐ง๐ฐ๐ญ๐ฅ๐ฆ๐ณ ๐ข๐ฏ๐ฅ ๐ฏ๐ข๐ฎ๐ฆ ๐ช๐ต ๐ข๐ณ๐ณ๐ข๐บ๐ด-๐ง๐ถ๐ฏ๐ค๐ต๐ช๐ฐ๐ฏ๐ด. ๐๐ณ๐ฆ๐ข๐ต๐ฆ ๐ข๐ฏ โ๐ช๐ฏ๐ฅ๐ฆ๐น.๐ซ๐ดโ ๐ง๐ช๐ญ๐ฆ ๐ข๐ฏ๐ฅ ๐ฑ๐ถ๐ต ๐ข๐ญ๐ญ ๐บ๐ฐ๐ถ๐ณ ๐ข๐ฏ๐ด๐ธ๐ฆ๐ณ๐ด ๐ช๐ฏ ๐ต๐ฉ๐ฆ๐ณ๐ฆ. ๐๐ฆ๐ฑ๐ข๐ณ๐ข๐ต๐ฆ ๐บ๐ฐ๐ถ๐ณ ๐ข๐ฏ๐ด๐ธ๐ฆ๐ณ๐ด ๐ถ๐ด๐ช๐ฏ๐จ ๐ค๐ฐ๐ฎ๐ฎ๐ฆ๐ฏ๐ต๐ด. ๐๐ถ๐ด๐ฉ ๐บ๐ฐ๐ถ๐ณ ๐ธ๐ฐ๐ณ๐ฌ ๐ช๐ฏ๐ต๐ฐ ๐ข ๐๐ช๐ต๐ฉ๐ถ๐ฃ ๐ณ๐ฆ๐ฑ๐ฐ๐ด๐ช๐ต๐ฐ๐ณ๐บ ๐ข๐ฏ๐ฅ ๐ด๐ถ๐ฃ๐ฎ๐ช๐ต ๐ต๐ฉ๐ฆ ๐๐ช๐ต๐ฉ๐ถ๐ฃ ๐ณ๐ฆ๐ฑ๐ฐ๐ด๐ช๐ต๐ฐ๐ณ๐บ ๐ญ๐ช๐ฏ๐ฌ ๐ช๐ฏ ๐๐ช๐ต๐ณ๐ฐ๐ฏ๐ฆ.
๐ Question 1
What are the differences between mutating array methods and non-mutation array methods in JavaScript. List 5 array methods that fall under each of them.
Mutation in context of JavaScript arrays is basically changing the array itself instead of returning a new array with the new changes.
Examples of 5 Array methods that fall under mutating are:
- array.pop()
- array.splice()
- array.unshift()
- array.reverse()
- array.sort()
Non-Mutation is returning a whole new array which has all the changes.
Examples of 5 Array methods that fall under mutating are:
- array.concat()
- array.indexOf
- array.toString()
- array.join()
- array.toLocaleString()
Here is an array of languages: [โC#โ, โJavaScriptโ, โRubyโ, โPHPโ, โPythonโ]. Perform this operation on them Add โKotlinโ to the end of the array Add โJavaโ after โRubyโ Remove the first item in the array Add โScalaโ and โSwiftโ to the beginning of the array Replace โPHPโ with โGoโ and โRustโ
What will be the value of fruit after calling the function changeFruit? let fruit = ['apple', 'mango', 'banana']; function changeFruit( fruit ) { fruit[2] = "orange"; return fruit; }
Write a function that accepts an array of numbers as an argument. Return the maximum value in the array. e.g., max([4, 5, 10, -2]) // maximum value is 10
Write a function called valTimesIndex which accepts an array of numbers and returns a new array with each value multiplied by the index it is at in the array: e.g., valTimesIndex([1,2,3]) // [0,2,6] valTimesIndex([5,10,15]) // [0,10,30]