Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

111
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda