How to solve quadratic equations with typescript code

output:

image

code:
function SolveEquation (a,b,c){
let d = bb - 4ac
console.log(“delta = “,d)
if (d> 0) {
console.log(“equation”,a,“x^2+”,b,“x+”,c,”=0 have 2 equation:”)
console.log(“x1 =”, (-b +Math.sqrt(d))/(2
a))
console.log(“x2 =”, (-b -Math.sqrt(d))/(2*a))
}else{
if (d == 0){
console.log(“The equation has a double solution”)
}else{
console.log(“The equation don’t has solution”)
}
}
}

SolveEquation(1,-8,15)

Hi @HenryHuy, how would you use this in a CoSpace? Can you give a scenario where it might be useful?

1 Like

It’s use to make game for mathematicians :joy:

I’m just wondering if it’s better to keep generic Typescript-focused topics on Typescript forums (if they have minimal relevance to CoSpaces)…?

Love your passion for it though!