You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
davhojt f35edc1253 docs(find-expression): correct grammar 2 years ago
..
README.md docs(find-expression): correct grammar 2 years ago

README.md

Find Expression

Instructions

Create a function named findExpression that takes a number as parameter and returns a string.

  • 2 constant variables will be made available to your function: add4 and mul2.
  • Your goal is to try to find a sequence, starting from the number 1, and repeatedly either adding 4 or multiplying by 2, to produce the number given as a parameter.
  • If the number can not be reached you should return undefined

For example, for the number 8, you must first multiply by 2 twice, and then add 4. Your function should return something like: 1 *2 *2 +4.

Notions

Code provided

The provided code will be added to your solution, and does not need to be submitted.

const add4 = '+4'
const mul2 = '*2'