You are viewing a single comment's thread. Return to all comments →
My JAVASCRIPT SOLUTION
function processData(input) { //Enter your code here let [date1, date2] = input.split('\n'); date1 = (date1.split(' ')); let [day1, month1, year1] = date1.map(e => parseInt(e));; date2 = (date2.split(' ')); let [day2, month2, year2] = date2.map(e => parseInt(e));; if(year1 < year2) { console.log('0'); } else if(year1 > year2) { console.log(10000); } else if(year1 === year2) { if(month1 < month2) { console.log('0'); } else if(month1 > month2) { console.log((month1 - month2) * 500); } else if(month1 === month2) { if(day1 < day2) { console.log('0'); } else if(day1 > day2) { console.log((day1 - day2) * 15); } else if(day1 === day2) { console.log('0'); } } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 26: Nested Logic
You are viewing a single comment's thread. Return to all comments →
My JAVASCRIPT SOLUTION