Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

120
Views
¿Cómo accedo a la propiedad de una función en Javascript?

Así que soy nuevo en Javascript y quería saber cómo debo agregar la variable red_btn a mi documento. El código actualmente no funciona. No estoy acostumbrado a usar funciones, por lo que mi código es correcto. Quería hacer algunos botones más en la función Buttons(). Por favor, ayúdame.

 function CreateCircle(r, color){ let canvas = document.getElementById("MyCanvas"); let ctx = canvas.getContext("2d"); ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.beginPath() ctx.arc(240, 200, r, 0 , 2 * Math.PI); ctx.fillStyle = color; ctx.stroke(); ctx.fill(); } function Buttons(){ const red_btn = document.createElement("button"); red_btn.innerHTML = "Button"; red_btn.name = "red_btn"; red_btn.type = "button"; red_btn.innerText = "Red"; } document.body.appendChild(Buttons.red_btn);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Debe ser solo lo siguiente:

 function Buttons(){ const red_btn = document.createElement("button"); red_btn.innerHTML = "Button"; red_btn.name = "red_btn"; red_btn.type = "button"; red_btn.innerText = "Red"; return red_btn; } document.body.appendChild(Buttons());
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!