This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Combinable = number | string; | |
type ConversionDescriptor = 'as-number' | 'as-text'; | |
function combine(input1: Combinable, input2: Combinable, resultConversation: ConversionDescriptor){ | |
let result; | |
if(typeof input1 === 'number' && typeof input2 === 'number' || resultConversation === 'as-number'){ | |
result = +input1 + +input2; | |
}else{ | |
result = `${input1} ${input2}`; |