What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-21 19:44:10
modify array js
Using a FOR loop, write a function addNumber which adds the argument n to each number in the array arr and returns the updated arr: const addNumber=(arr, n)=>{ let arr1=[]; for(let i=0;i<Math.max(arr.length);i++){ arr1.push((arr[i]||0)+n)... Add solution -
Java 2021-11-21 16:51:20
Reverse an array in java using for loop
// Reverse an array in java using for loop public class ReverseArrayUsingForLoop { public static void main(String[] args) { int[] arrNumbers = new int[]{2, 4, 6, 8, 10}; System.out.println("Given array: "); for(int ... Add solution -
Python 2021-11-20 16:07:18
continue in python
The continue statement in Python returns the control to the beginning of the while loop. The continue statement rejects all the remaining statements in the current iteration of the loop and moves the control back to the top of the loop. The continue s... Add solution -
Java 2021-11-16 20:12:12
java print each line of a list
//To print each item in a list we use the print line function //First we need a list, i will be using an array list to start String[] animals = {"dog", "cat", "elephant", "moose"}; //Next we need a way to go trhoug... Add solution