Ad
Code
Diff
  • function numMinusSeven(num) {
        return (num-num%7)/7+1
    }
    
    • function numMinusSeven(num) {
    • let aaaaaaaaaaaaaaaaaa = []
    • while (num > 0) {
    • num -= 7
    • aaaaaaaaaaaaaaaaaa.push(num)
    • }
    • return aaaaaaaaaaaaaaaaaa.length
    • return (num-num%7)/7+1
    • }
Code
Diff
  • function numMinusSeven(num) {
      return (num-(num%7))/7+1
    }
    • function numMinusSeven(num) {
    • const result = [];
    • for (let i = num; i > 0; i -= 7) {
    • result.push(i - 7);
    • }
    • return result.length;
    • return (num-(num%7))/7+1
    • }
Code
Diff
  • const addArr = (arr) => {
      return arr.length>0 ? arr.reduce((sum, a) => sum + a) : null;
    };
    
    • const addArr = (arr) => {
    • let sum = 0;
    • for (let i = 0; i < arr.length; i++) {
    • sum += arr[i];
    • }
    • return sum || null;
    • return arr.length>0 ? arr.reduce((sum, a) => sum + a) : null;
    • };
Code
Diff
  • function addArr(arr){  
      return arr.length>0 ? arr.reduce((sum, a) => sum+a) : null;
    }
    • function addArr(arr){
    • if(arr.length === 0) return null
    • let final = 0
    • arr.forEach(num => {
    • final += num
    • })
    • return final
    • function addArr(arr){
    • return arr.length>0 ? arr.reduce((sum, a) => sum+a) : null;
    • }