Newbie question: memory address

how to refer a specific memory address??
What type do i store the value??

thank for reply

If you are referring to JavaScript, there is no concept of memory addresses available in the language in the way C/C++ or Rust uses them. Variables will be set to either primitive values themselves or references to non-primitive values automatically.

1 Like

To go off of what @chris-tse explained, to define a variable in JavaScript, it’ll look something like:

var variable1 = "Hello";
let  variable2 = 3;
const variable3 = ["I", "Am", "An", "Array"];

Right. For actual direct memory access and manipulation, JS doesn’t do that. For that you’d need a “low level” language, one “closer” to what is actually going on, like the ones mentioned. JS is more of a “high level” language in that you are abstracted away from the inner workings and it is done for you. There are advantages and disadvantages to both, and in some cases one is a better choice than another.

As far as “type”, JS has fewer types than many languages (again, abstracted from the hardware) and unlike many languages, the variables aren’t typed. Any variable can be assigned any type at any time. In JS, the values are typed.