My Experience at Intermediate Projects

Not exactly, I used Google API to get user’s home lat/lng location. Then I displayed a map… see my link above, post 17/20. Also, user can drag map to new location and display weather on new location.

I cant find the post 17/20, only 16/21, which has this link

https://randomquote-owel.surge.sh

I did look at that link and click on the weather app, no weather info is showing in the weather app window.

Do you mind sharing the code snippet of how you get the local lat/long location, please ?

Like so:

function initMap() {
      map = new google.maps.Map(document.getElementById('map'), {
        zoom: 12
      });

      // Try HTML5 geolocation.
      if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(function(position) {
          var pos = {
            lat: position.coords.latitude,
            lng: position.coords.longitude
          };
          // this is the user's location
          var myLat = pos.lat;
          var myLng = pos.lng; 

          // display user's location as center of map
          map.setCenter(pos);

          // now that we know user's location, get the weather info by calling weather api
          // use https://crossorigin.me/some-http-url to allow http access from https origin
          // alternative: https://cors-anywhere.herokuapp.com/      
          getWeather(myLat, myLng);
          
        }, function() {
          handleLocationError(true, infoWindow, map.getCenter());
        });
      } else {
        // Browser doesn't support Geolocation
        handleLocationError(false, infoWindow, map.getCenter());
      }
    }

    function handleLocationError(browserHasGeolocation, infoWindow, pos) {
      infoWindow.setPosition(pos);
      infoWindow.setContent(browserHasGeolocation ?
                            'Error: The Geolocation service failed.' :
                            'Error: Your browser doesn\'t support geolocation.');
      infoWindow.open(map);
    }

then call google maps api at bottom of your html page

<!-- google maps -->
<script 
  async 
  defer 
  src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC0V0yDJBNvnaSVz3XCsm5Pyu91U144DcM&callback=initMap">
</script>
1 Like

Here’s a sample screenshot

ah … thanks, I know why I saw blank windows - my browser blocks location tracking.

No problem… :slight_smile: It really does take a while to get used to. Keep up the work :slight_smile:

Try not to get too discouraged when you fail to do something. I’ve been a developer for about 4 years now, I still run into issues where I struggle. When you’re at your wits end, step away. Go for a walk, come back and look at it with fresh eyes.

Basically reiterating what others have said. Break things down starting at the highest level and gradually working your way down. Start with “build weather app” then break that down to needing to build the HTML, needing to query the APi, and needing to display results. Then each of those those individual task, break them down. Keep going through that process until you can’t break the tasks down any further. It will probably be helpful if you then organize those tasks in a kanban board such as Trello or KanbanFlow. Then just work through the tasks one at a time. When you run into issues on a single task, research it. Beyond tutorials look at API docs. No tutorial is going to cover all of what a language or library can do. Tutorials are a starting point.

Which brings me to the use multiple sources point. Use other tutorials such as Codecademy and Code School, use videos on YouTube, read books. When reading books don’t just read books that explain a certain library or the general ‘How to build web apps’. Read books that talk about the JavaScript language itself. JavaScript: The Good Parts is the defacto book on understanding how the JS language works, it predates ES6 so none of the new features are discussed but it really explains why JS has some of the trickiness that it does. It’s a very short book, but very dense. Never read more than one chapter at a time. Read one chapter and apply the skills in it by practice. You’ll see a lot of discussion around the net about “the JavaScript trilogy”, The Good Parts is the first of the three. The other two being JavaScript Patterns and High Performance JavaScript.

The Good Parts is a book every JS developer should own. Having said that, with out dense it is I don’t view it as a starting point. Another book that is equally short, but I feel is more approachable is The Principles of Object Oriented JavaScript. It’s a much easier read and is packed with good information. I would say start with this one, then take a look at the trilogy.

Third point I want to reiterate is practice practice practice. Keep coding. Don’t just do tutorials and read books. Build apps! Learn something, apply it. Build an app, then refine it. Then start another app. Then go back to previous apps and improving them. The more you build things, the more you’ll see where you need to improve. Focus on those areas. Also the more you code, the more you’ll see other technologies you want to learn. Different skills, libraries, frameworks, even languages. The more you do this you’ll find new things that excite you. Really dive into the things that excite you, but also keep working on skills the supplement the ones that excite you.

Welcome to life-long learning. There will always be struggles and frustrations, but there is also the regular feeling of victory when you conquer a problem. Sometimes I run into a problem I realize will take me two days and put me behind on progress towards my deadline, but then after clearing my head I dive into it and solve it in two hours. Before long you will have similar experiences, and you will feel super human.

1 Like

I also became disillusioned with the style of the courses offered by Free Code Camp and Code Academy too. A lot of the concepts have a very high level explanation and sometimes jump to the next topic without explaining things well. Lynda courses and w3schools.com have been much better sources that explain concepts in a much clearer way.

I don’t think it’s fair to compare it to a class – FCC gives you a few examples of stuff that works in a specific context, then throws you into the water. A good teacher would break the exercises into smaller exercises where you figure out smaller problems on your own, then realize how all those solutions can be synthesized to solve the larger problem. FCC takes you from unconsciously unskilled to consciously unskilled way too quickly, but doesn’t give you any feedback or help as you move from consciously unskilled to consciously skilled.