Skip to content

Instantly share code, notes, and snippets.

View Kielx's full-sized avatar
🎯
Focusing

Krzysztof Pantak Kielx

🎯
Focusing
View GitHub Profile
@Kielx
Kielx / evenDigitsOnly.js
Created June 6, 2020 18:22
evenDigitsOnly scrimba coding challange
//function checkIfEven checks if given number consists of only even digits
const checkIfEvenDigit = function (number) {
if (number % 2 === 0) {
return true;
} else {
return false;
}
};
@Kielx
Kielx / sumPrimes.js
Last active June 6, 2020 18:20
sumPrimes scrimba coding challange
//function sumPrimes sums all prime numbers up to the provided number
const isPrime = function (number) {
if (number <= 2) {
return 1;
}
for (let i = 2; i < number; i++) {
if (number % i === 0) {
return 0;
}
@Kielx
Kielx / firstDuplicate
Last active June 6, 2020 18:16
Scrimba coding challanges
//function to find first duplicate in array
function firstDuplicate(nums) {
let MyObj = {}
let myArr = []
for (i=0; i< nums.length ; i++){
for (j=i+1; j< nums.length; j++){
if(nums[i] === nums[j]){
MyObj[nums[i]] = j;
}