Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Latest commit

 

History

History
38 lines (25 loc) · 1020 Bytes

File metadata and controls

38 lines (25 loc) · 1020 Bytes

In this exercise you'll be writing code to understand the concepts of type conversion that you might encounter in your everyday code

Given two arrays made up of digits, write a function that turns the digits into numbers and then sums the numbers.

Tasks

1. Find the sum of two arrays

Implement a function to calculate the sum of two array element given the array of two numbers:

twoSum([1, 2, 3], [0, 0, 7])
//=> 130

The result should be a number and the array element only contains as integer

2. Determine if the number is lucky

After the calculator the owner would like to know the sum that he got is a lucky number or not. A number is said to be lucky if it is a palindrome.

Implement a function to determine whether the number is lucky.

luckyNumber(1441)
//=>  true
luckyNumber(123)
//=> false

3. Dashify a number

Implement a function that interpolates a dash between each number, converting it to a string.

dashify(1466)
//=> "1-4-6-6"