Skip to content

First Commit, 3 passing Tests #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions every/core.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
// Check to see if all elements in an array
// are even numbers.

function allEven (input) {
return input;
};
function allEven(input){
for(let i = 0; i < input.length; i++) {
if(input[i] % 2 !== 0){
return false;
}
}
return true;
}


// Check to see if all elements in an array
// are of the same type.

function allSameType (input) {
return input;
for(let i = 1; i < input.length; i++) {
if(typeof input[i] !== typeof input[i-1]){
return false;
}
}
return true;
};

// Check to see if every element in the matrix is
// an array and that every element in the array is
// greater than 0.

function positiveMatrix (input) {
return input;
function positiveMatrix(input) {
for (let i = 0; i < input.length; i++) {
for (var j = 0; j < 3; j++) {
if (input[i][j] <= 0) {
return false;
}
}
}
return true;
};

// Check that all items in an array are strings
Expand Down