{"id":165,"date":"2026-03-28T19:50:57","date_gmt":"2026-03-28T19:50:57","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/d_eanes\/?p=165"},"modified":"2026-03-28T19:50:57","modified_gmt":"2026-03-28T19:50:57","slug":"free-friday-2-27-26","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/d_eanes\/2026\/03\/28\/free-friday-2-27-26\/","title":{"rendered":"Free Friday 2\/27\/26"},"content":{"rendered":"\n<p>Today I built a weather app using HTML, CSS, and JavaScript. The user enters a city, and the app fetches real-time weather data from an API. It then displays the city name, temperature, humidity, weather description, and an emoji that matches the conditions.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>weatherForm.addEventListener(\"submit\", async event =&gt; { ... })<\/code><\/pre>\n\n\n\n<p>^This handles the form submission. It prevents the page from reloading, gets the city input, calls the weather API, and either displays the data or shows an error.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>async function getWeatherData(city):<\/code><\/pre>\n\n\n\n<p>^This function sends a request to the OpenWeather API using the city name.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function displayWeatherInfo(data):<\/code><\/pre>\n\n\n\n<p>^This function takes the API data and displays it on the page. It gets the city name, temperature, humidity, and description, then converts the temperature to Fahrenheit, creates elements, and adds them to the card.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function getWeatherEmoji(weatherId):<\/code><\/pre>\n\n\n\n<p>^This function returns an emoji based on the weather condition ID. It uses ranges to match different weather types like rain, snow, clouds, or clear skies.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function displayError(message):<\/code><\/pre>\n\n\n\n<p>^This function shows an error message on the screen. It clears the card and displays the message when the user enters an invalid city or the API request fails.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"352\" src=\"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-content\/uploads\/2026\/03\/Screenshot-2026-03-28-154417-1024x352.png\" alt=\"\" class=\"wp-image-166\" srcset=\"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-content\/uploads\/2026\/03\/Screenshot-2026-03-28-154417-1024x352.png 1024w, https:\/\/theroyalscode.com\/students\/d_eanes\/wp-content\/uploads\/2026\/03\/Screenshot-2026-03-28-154417-300x103.png 300w, https:\/\/theroyalscode.com\/students\/d_eanes\/wp-content\/uploads\/2026\/03\/Screenshot-2026-03-28-154417-768x264.png 768w, https:\/\/theroyalscode.com\/students\/d_eanes\/wp-content\/uploads\/2026\/03\/Screenshot-2026-03-28-154417-1536x528.png 1536w, https:\/\/theroyalscode.com\/students\/d_eanes\/wp-content\/uploads\/2026\/03\/Screenshot-2026-03-28-154417-2048x704.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I built a weather app using HTML, CSS, and JavaScript. The user enters a city, and the app fetches real-time weather data from an API. It then displays the city name, temperature, humidity, weather description, and an emoji that matches the conditions. ^This handles the form submission. It prevents the page from reloading, gets&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-165","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/posts\/165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/comments?post=165"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/posts\/165\/revisions"}],"predecessor-version":[{"id":167,"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/posts\/165\/revisions\/167"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/media?parent=165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/categories?post=165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/tags?post=165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}