JavaScript 30- Day 21 Study Notes

Jeffrey Amen
1 min readDec 28, 2020
https://javascript30.com/

Day 21 of JavaScript 30 by Wes Bos used an app called x-code to create a geolocation app. The x-code app is exclusive to the Mac ecosystem and since I use Windows, I had to sit this one out. I followed along with the coding, but could not build out the app.

Bos set two variables to access the HTML elements.

const arrow = document.querySelector('.arrow');const speed = document.querySelector('.speed-value');

And used one function to process the information and change the display accordingly.

navigator.geolocation.watchPosition((data)=> {   speed.textContent = data.coords.speed;   arrow.style.transform = `rotate(${data.coords.heading}deg)`}, (err)=> {      console.err(err);      alert('Hey! You gotta allow that to happen!');});

It looks like a cool app and I would have liked to make it. Apparently, you can connect this app to a mobile device, Apple devices only.

Follow my study notes as I progress through JavaScript 30.

--

--

Jeffrey Amen

Retired physician, writer, aspiring website designer and developer