Advertisement
Spocoman

01. Sum First and Last Array Elements

Jan 20th, 2022
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.  
  3.     console.log(input[0] + input[input.length - 1]);
  4.  
  5. }
  6.  
  7.  
  8. Или:
  9.  
  10. function solve(input) {
  11.    
  12.     console.log(input.shift() + input.pop());
  13.    
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement