0

I'm still a beginner in javascript. I copy this javascript code here

  function memo(pnt){
      var row = pnt.lng().toFixed(5);
      row += ", ";
      row += pnt.lat().toFixed(5);
      row += ", ";
      row += pnt.address;
      row += "\n";
      printOut.value += row;
    }

and turn I want to asign

var lang = pnt.lng().toFixed(5); 

var lat = pnt.lat().toFixed(5);

var add = pnt.address;

the row is incremented.

but I get it wrong. what is the correct arrangement for this?

2 Answers 2

3

pnt.lng().toFixed(5) = var lang

This is wrong to start with.

If I've followed your question correctly, you'll want something like:

var lang = pnt.lng().toFixed(5);

to assign the value of pnt.lng().toFixed(5) to lang.

Sign up to request clarification or add additional context in comments.

1 Comment

but it is incremented. doesn't that affect the values if I assigned it like ar lang = pnt.lng().toFixed(5);?
0

The ## var ## keyword simply identifies a new variable. You don't need to have it on re-assigning a variable.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.