Published on January 26, 2024By DeveloperBreeze

const apiKey = 'YOUR_API_KEY';
const city = 'New York';
const apiUrl = `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${apiKey}`;
fetch(apiUrl)
    .then(response => response.json())
    .then(data => console.log('Weather Information:', data))
    .catch(error => console.error('Error:', error));

Comments

Please log in to leave a comment.

Continue Reading:

Fetching Chuck Norris Jokes from API in JavaScript

Published on January 26, 2024

javascript