JavaScript Day 34 — Mastering JavaScript Basics: A Comprehensive Guide for Interview Preparation
100 Days of JavaScript Interview Prep: A Beginner’s Journey

Understanding the HTTP Status Code
Welcome to Day 34–100 Days of JavaScript Interview Prep: A Beginner’s Journey with understanding the HTTP Status Code.
WHAT DO YOU UNDERSTAND BY HTML ?
1. Hypertext Transfer Protocol (HTTP) is an application-layer protocol for transmitting hypermedia documents such as HTML.
2. It is foundation of data communication on the World Wide Web.
3. It follow a client-server model where a client (means browser) sends a request to the server and the server responds with the requested resource, typically a webpage.
MOST USABLE HTTP RESPONSE STATUS CODE
200 OK
The request has succeeded.
Example: When you successfully load a webpage.201 Created
It indicates that the request has been fulfilled
and a new resource has been created as a result.
Example: When a POST request is made to create a new resource on a server,
such as submitting a form to create a new user account,
the server might respond with a 201
Created status code along with the details of the newly created resource.202 Accepted
It indicates that the request has
been accepted for processing,
but the processing has not been completed yet.
Example: When a client sends a request to a server
that requires time-consuming processing,
such as batch processing or queuing a task for
later execution, the server might respond with a 202
Accepted status code to acknowledge the request
without indicating whether it has been successfully completed.204 NO Content
It indicates that the
server has successfully processed the request and
there is no content to send in the response payload.
Example:
When a client sends a request that does not
require a response body, such as a successful
DELETE request to remove a resource,
the server might respond with a 204
No Content status code to indicate that the
request was successful but there is no additional
information to return in the response.301 Moved Permanently —
The requested resource has been permanently moved to a new URL.
Example When a webpage has been permanently redirected to a new location302 Moved Temporarily
It indicates that the requested
resource has been temporarily moved to a different URL.
Example: It's commonly used for temporary redirections.307 Temporary redirect
Similar to 302, it indicates that the
requested resource has been temporarily moved to a different URL.
Example:
It's used to redirect temporarily
but with the expectation that the same method (GET, POST, etc.)
should be used for the redirected request.400 — Bad Request
The server cannot process the request due to a client error.
Example: When there's a syntax error in the request sent by the client.401 Unauthorized
The request requires user authentication.
Example: When trying to access a protected resource without logging in.403 — Forbidden
The server understood the request but refuses to authorize it.
Example: When trying to access a resource for which you don't have permission.404 — Not Found
The server cannot find the requested resource.
Example: When trying to access a webpage that doesn't exist405 — Method not allowed
It indicates that the
request method (GET, POST, PUT, DELETE, etc.) is not supported
for the requested resource.
Example: It's returned when trying to use an unsupported
HTTP method for a particular resource.406 — Not Acceptable
It indicates that the server cannot
generate a response that meets the criteria specified
in the client's request headers.
Example: It's commonly used when the client
requests a response in a format that the server cannot provide500 —Internal server error
A generic error message indicating that something has
gone wrong on the server.
Example:
When there's an unexpected server-side issue that prevents
it from fulfilling the request.501- Not Implemented
It indicates that the server does not support the
functionality required to fulfill the request.
Example: It's returned when the server doesn't
recognize the request method or lacks the ability to fulfill the request.
502 — Bad Gateway
It indicates that the server received an
invalid response from an upstream server while acting as a gateway or proxy.
Example: It's often seen when there are communication issues between servers.503 — Service Unavailable
The server is currently unable to handle the request
due to temporary overload or maintenance of the server.
Example: When a website is temporarily down for maintenance.504 — Gateway Timeout
It indicates that the server, while
acting as a gateway or proxy, did not receive
a timely response from an upstream server
Example:
It's often seen when there are communication issues
between servers or when an upstream server is slow to respond505 — HTTP version not Supported
It indicates that the server does not support the
HTTP protocol version used in the request.
Example: It's returned when the client sends a request using an
HTTP version that is not supported by the server.511 — Network Authentication required
It indicates that the client needs to authenticate
to gain network access.
Tomorrow we will learn about CORS Policy Related Questions :)
Happy Coding and Stay Tuned :)
Kind is always cool !!!
Share knowledge to gain knowledge !!!!
Be kind and treat people with respect !
If you find my blog helpful, then please subscribe, claps and follow to support :)

