8 kyu

Arguments to Binary addition

3,041 of 3,411Javatlacati

Description:

Given an array add all the number elements and return the binary equivalent of that sum; to make the code bullet proof anything else than a number should be added as 0 since it can't be added.

If your language can handle float binaries assume the array won't contain float or doubles.

arr2bin([1,2]) == '11'
arr2bin([1,2,'a']) == '11'
arr2bin([]) == '0'

NOTE: NaN is a number too in javascript for decimal, binary and n-ary base
arr2bin [1,2] == '11'
arr2bin [1,2,'a'] == '11'
arr2bin [] == '0'
arr2bin([1,2]) == '11'
arr2bin([1,2,'a']) == '11'
arr2bin([]) == '0'
arr2bin([1,2]) == '11'
arr2bin([1,2,'a']) == '11'
arr2bin([]) == '0'

This is a modification on the Kata: Array2Binary addition hope you like it

Arrays
Binary
Fundamentals

Stats:

CreatedJun 17, 2016
PublishedJun 17, 2016
Warriors Trained6662
Total Skips239
Total Code Submissions22903
Total Times Completed3411
JavaScript Completions3041
CoffeeScript Completions28
TypeScript Completions357
PHP Completions103
Total Stars60
% of votes with a positive feedback rating84% of 636
Total "Very Satisfied" Votes484
Total "Somewhat Satisfied" Votes97
Total "Not Satisfied" Votes55
Ad
Contributors
  • Javatlacati Avatar
  • dnolan Avatar
  • myjinxin2015 Avatar
  • donaldsebleung Avatar
  • Chrono79 Avatar
  • kazk Avatar
  • Voile Avatar
  • Madjosz Avatar
Ad