Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

113
Visualizações
How to implement javascript into an html page

I would like to implement this script into a html page :

function rcirc(x, y, m, b) {
  let m2 = -1 / m;
  let b2 = y - (m * x);
  let y2 = (b2 - b) / (m - m2);
  let x2 = (y2 - b) / m;
  return [x2, y2];
}

var x = window.prompt("enter the x value: ");
var y = window.prompt("enter the y value: ");
var m = window.prompt("enter the m value: ");
var b = window.prompt("enter the b value: ");
let point = rcirc(x, y, m, b);

alert(point);

I tried adding <script></script> around the code but it does not work.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Hi Hoadi here is a working example of your code implemented into an html "website". The html renders after you clicked away the final alert.

<hml>
    <body>
        <h1>some stuff...</h1>
    </body>
    <script>
function rcirc(x, y, m, b) {
    let m2 = -1/m;
    let b2 = y - (m * x);
    let y2 = (b2 - b) / (m - m2);
    let x2 = (y2 - b) / m;
    return [x2, y2];
  }

  var x = window.prompt("enter the x value: ");
  var y = window.prompt("enter the y value: ");
  var m = window.prompt("enter the m value: ");
  var b = window.prompt("enter the b value: ");
  let point = rcirc(x, y, m, b);
  alert(point);
</script>
</hml>
I hope this was helpful.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda