Hello Programmers/Coders, Today we are going to share solutions of Programming problems of HackerRank, 10 Days Of JavaScript. At Each Problem with Successful submission with all Test Cases Passed, you will get an score or marks. And after solving maximum problems, you will be getting stars. This will highlight your profile to the recruiters.
In this post, you will find the solution for Day 5: Arrow Functions in JavaScript-HackerRank Problem. We are providing the correct and tested solutions of coding problems present on HackerRank. If you are not able to solve any problem, then you can take help from our Blog/website.
Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.
Introduction To JavaScript
JavaScript is a lightweight, cross-platform, and interpreted scripting language. It is well-known for the development of web pages, many non-browser environments also use it. JavaScript can be used for Client-side developments as well as Server-side developments. JavaScript contains a standard library of objects, like Array, Date, and Math, and a core set of language elements like operators, control structures, and statements.
Advantages of JavaScript
The merits of using JavaScript are −
- Less server interaction − You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server.
- Immediate feedback to the visitors − They don’t have to wait for a page reload to see if they have forgotten to enter something.
- Increased interactivity − You can create interfaces that react when the user hovers over them with a mouse or activates them via the keyboard.
- Richer interfaces − You can use JavaScript to include such items as drag-and-drop components and sliders to give a Rich Interface to your site visitors.
Link for the Problem – Day 5: Arrow Functions – Hacker Rank Solution
Day 5: Arrow Functions – Hacker Rank Solution
Problem:
Objective
In this challenge, we practice using arrow functions. Check the attached tutorial for more details.
Task
Complete the function in the editor. It has one parameter: an array, . It must iterate through the array performing one of the following actions on each element:
- If the element is even, multiply the element by .
- If the element is odd, multiply the element by .
The function must then return the modified array.
Input Format
The first line contains an integer, , denoting the size of .
The second line contains space-separated integers describing the respective elements of .
Constraints
![Day 5: Arrow Functions in JavaScript | 10 Days Of JavaScript Solutions | HackerRank Programming Solutions [💯Correct] 2 image 27](https://technorj.com/wp-content/uploads/2021/12/image-27.png)
Output Format
Return the modified array where every even element is doubled and every odd element is tripled.
Sample Input 0
5 1 2 3 4 5
Sample Output 0
3 4 9 8 15
Explanation 0
![Day 5: Arrow Functions in JavaScript | 10 Days Of JavaScript Solutions | HackerRank Programming Solutions [💯Correct] 3 image 26](https://technorj.com/wp-content/uploads/2021/12/image-26.png)
Day 5: Arrow Functions – Hacker Rank Solution
function modifyArray(nums) { let newArr = []; for (let i = 0; i < nums.length; i++) { if (nums[i] % 2 === 0) { newArr.push(nums[i] * 2); } else { newArr.push(nums[i] * 3); } } return newArr; }
cialis 40mg without prescription buy cialis 5mg online buy pills for erectile dysfunction
brand duricef 500mg generic finasteride 1mg order finasteride 5mg online
estradiol cost buy estradiol paypal minipress price
purchase fluconazole buy ampicillin 500mg pills buy cheap ciprofloxacin
vermox 100mg cheap vermox 100mg us buy tadalis without prescription
order flagyl 200mg online buy cheap cephalexin order cephalexin 250mg for sale
avanafil oral buy voltaren 50mg without prescription buy voltaren 100mg generic
cleocin 150mg uk buy cleocin pills for sale ed pills that work quickly
buy indocin capsule lamisil generic cefixime medication
nolvadex 10mg brand purchase cefuroxime generic ceftin 250mg oral
order trimox 250mg pill clarithromycin 500mg canada clarithromycin 500mg canada
oral careprost methocarbamol 500mg for sale buy desyrel 50mg generic
buy clonidine 0.1mg for sale order antivert 25mg pill order spiriva generic
suhagra 100mg price order sildenafil without prescription sildenafil 200mg for sale
buy minocycline 50mg online cheap minocin 50mg price actos tablet
leflunomide pill viagra 100mg cost buy azulfidine 500mg
cialis 5mg without prescription cheap tadalafil generic order tadalafil 5mg pills
cost of stromectol medication deltasone 40mg cost prednisone 5mg canada
buy altace 5mg online buy etoricoxib tablets etoricoxib us
mesalamine brand astelin 10ml brand irbesartan 150mg us
order acetazolamide 250 mg online order azathioprine azathioprine price
lanoxin 250mg cost buy digoxin medication molnunat order online
naprosyn 250mg sale omnicef 300mg us purchase prevacid for sale