I'm struggling to formulate a Javascript function that would allow me to create 2 numbers out of a user input, according to 2 rules.
let userInput;
let num1;
let num2;
Rules: num1 + num2 = userInput and num1 - num2 must be the smallest positive number possible.
So with a user input of 5 the function should return 3 and 2 for num1 and num2 and not 4 and 1.
Could you please help me formulate such a Javascript function?
Thanks in advance for your help :)