What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-03 18:58:03
convert json to 2d array
function jsonArrayTo2D(arrayOfObjects){ let header = [], AoA = []; arrayOfObjects.forEach(obj => { Object.keys(obj).forEach(key => header.includes(key) || header.push(key)) let thisRow = new Array(header.length); header.forEach... Add solution -
Other 2021-09-03 17:15:02
dart find difference between lists
List<double> first = [1,2,3,4,5,6,7]; List<double> second = [3,5,6,7,9,10]; List<double> output = []; first.forEach((element) { if(!second.contains(element)){ output.add(element); } }); //at this point, output list should have ... Add solution -
Java 2021-09-03 04:18:01
java Iterable to list
@Test public void whenConvertIterableToListUsingJava8_thenSuccess() { List<String> result = new ArrayList<String>(); iterable.forEach(result::add); assertThat(result, contains("john", "tom", "jane")); } Add solution -
C# 2021-09-02 15:07:02
get prime number c#
// Assuming that the number passed is higher than 1. // This function will check if the number is prime by using all the previous // numbers. There's no need to check further than the square root // Returns true or false. public static bool isPrime(int... Add solution -
PHP 2021-09-02 14:21:03
show selected value in dropdown laravel
<select class="js-states browser-default select2" name="shopping_id" required id="shopping_id"> <option value="option_select" disabled selected>Shoppings</option> @foreach($shopping... Add solution -
Javascript 2021-09-01 04:49:03
loop through an array in javascript
var data = [1, 2, 3, 4, 5, 6]; // traditional for loop for(let i=0; i<=data.length; i++) { console.log(data[i]) // 1 2 3 4 5 6 } // using for...of for(let i of data) { console.log(i) // 1 2 3 4 5 6 } // using for...in for(let i in data) { con... Add solution