Yes, in fact, all objects and arrays are pointers.
If I have to take your example literally, then, you only need to turn the variables to be of object types E.g.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pointers</title>
</head>
<body>
<h1>Asynchronous JavaScript</h1>
<!--the pointer with class b--->
<p>Our City</p>
<p id="variableA" >Minnesota</p>
<script src="pointers.js" ></script>
</body>
</html>
Then the pointers.js:
var a = {name: "todos", data: {pointerOne: 'Minnesota', pointerTwo: 'NewYork'}};
var b = a;//pointer to a
setTimeout(()=>{
//using timeout to see our pointer at work!
b.data.pointerOne = 'Nairobi';
document.getElementById('variableA').innerHTML = a.data.pointerOne;
}, 3000);
The major difference in JavaScript, is the way the pointers are actually presented or the lack of a direct way to identify pointers. In C, Golang, and C# pointers are made using the ‘&’ operator.
This is the basic. After getting this concept, you can now develop it further into function pointers, linked lists, or use it like structs; and do JavaScript the C++ way.
Though I would advice you to use the current JavaScript convention in naming your variables.
i.e
const a = {name: "todos", data: {pointerOne: 'Minnesota', pointerTwo: 'NewYork'}};
const b = a;//pointer to a
swapfunction like in C :)[a, b] = [b, a];aandbare references :) I mean you can't swap the values of primitives (for example numbers) in another function but you can do it easily in C with pointers