about | help | code help+videos | done | prefs |
Write a method that converts an array of binary digits into the equivalent integer value. However, it is possible that there is an error in the array. An error is any digit other than 1 or 0. In the event of an error, return -1. If there is no error, return the integer value that matches the binary number represented by the array. sunFunBinary([1]) → 1 sunFunBinary([1, 1, 1]) → 7 sunFunBinary([0, 0, 1]) → 1 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy