sumn2u / learn-javascript

A book that teaches JavaScript 📗💻📖
https://javascript.sumankunwar.com.np
Apache License 2.0
922 stars 147 forks source link

Title: Proposal: Add Section on "Web APIs" to Learn JavaScript #212

Closed srishti-coder closed 4 months ago

srishti-coder commented 5 months ago

Proposal to Add a New Section on "Web APIs"

Summary: I propose to add a new section titled "Web APIs" to the Learn JavaScript project. This section will cover various Web APIs that are essential for modern JavaScript development.

Outline:

  1. Introduction to Web APIs
  2. DOM Manipulation
  3. Fetch API
  4. Geolocation API
  5. Canvas API
  6. Storage API
  7. Notification API
  8. Example Code:
    • Simple fetch request
    • Drawing shapes on Canvas
    • Getting user location
    • Storing data in localStorage

Code Example

// Example of Fetch API fetch('https://api.example.com/data') .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));

// Example of Canvas API const canvas = document.getElementById('myCanvas'); const ctx = canvas.getContext('2d'); ctx.fillStyle = '#FF0000'; ctx.fillRect(0, 0, 150, 75);

Benefits:

Provides practical examples of using Web APIs. Enhances learners' understanding of how to interact with the browser and web server. Makes the curriculum more comprehensive and up-to-date with current JavaScript practices.

I look forward to discussing this proposal further and am open to suggestions or feedback. Thank you for considering my contribution.

sumn2u commented 5 months ago

@srishti-coder It's a great proposal. I can see the benefits. Would it be okay if we include examples in their respective sections?

srishti-coder commented 5 months ago

@sumn2u Thanks for the approval. Each section will have examples.

sumn2u commented 5 months ago

@sumn2u Thanks for the approval. Each section will have examples.

I've assigned you this task, but please let me know if you have any questions or if anything is unclear.

srishti-coder commented 5 months ago

Thank you @sumn2u . I will let you know when needed.