js-mentorship-razvan / javascript

Javascript study notes
GNU General Public License v3.0
22 stars 2 forks source link

By 3, or not by 3? That is the question . . . #504

Closed RazvanBugoi closed 4 years ago

RazvanBugoi commented 4 years ago

https://www.codewars.com/kata/59f7fc109f0e86d705000043/train/javascript

RazvanBugoi commented 4 years ago
function divisibleByThree(str){
  let num = str.split('').map((el) => Number(el)).reduce((a,b) => a+b, 0);
    return num % 3 == 0;
}