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

323
Views
5.6.5 Coordinates, Answer In Comments (CodeHS)

The prompt of the assignment is "Write a program that shows the X and Y coordinates of the mouse in a label on the top left of the screen. You should update the values of the coordinates whenever the mouse moves." The basic code I have laid out is:

var pos;

function start(){
    mouseMoveMethod(mousePos);
}

function mousePos(e){
    pos = new Text("((" + e.getX() + "," + e.getY() + ")");
    pos.setPosition(75, 75)
    add(pos);
}

It "works" but it just keeps adding text over top of the new text instead of updating the existing text. I know I'm missing something, but I just cannot figure out what to implement to make it work the way it needs to. I've been stuck for days :(

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I got it!!! I just needed to think smarter LOL

var pos;

function start(){
    pos = new Text(" ");
    pos.setPosition(75, 75)
    add(pos);
    mouseMoveMethod(mousePos);
}

function mousePos(e){
    pos.setText("(" + e.getX() + "," + e.getY() + ")");
}
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!