Skip to content

Instantly share code, notes, and snippets.

View AdrianCiuciui's full-sized avatar

Adrian Ciuciui AdrianCiuciui

View GitHub Profile
@AdrianCiuciui
AdrianCiuciui / Orza_challange_1
Last active June 2, 2018 16:06
This code will display the second level of an array
//var myNumber = [10, 20, 30, [100, 200], 40, 50]; //your simple array
var myNumber = [1,5,[1,2],[3,4],10,9,[5],[6,[99,99,[99,[88,88,[77,77]],99]]]];//multilevel array
//var myNumber = [7,6,5,4,3,[[[[0]]]]];//no depth array
console.log("This code will dinamically display ONLY the second level of the following array:\n"+JSON.stringify(myNumber)+'\n');
// Solution #A =====================================
for(i=0;i<myNumber.length;i++){
var lvlTwoCount=0;//Pt cand nu este nici un level 2 in array
for(j=0;j<myNumber[i].length;j++){
if (myNumber[i][j]!=0) {//am scris mai jos rolul intentionat pt acest if
@AdrianCiuciui
AdrianCiuciui / evenNumbers.js
Last active May 28, 2018 14:48
This code will display all the even numbers from the array
console.log("This code will check to see if there are any even numbers");
var numere = [3, 5, 7, 33, 13, 15, 787, 1345, 1357, 1231435, 88];
var pare=[]; //locul unde se vor aduna toate nr pare
function par (a) { //functie pt a returna True/False pt numarul introdus
if (a%2==0) {
return true;
} else {
return false;
}}