<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Soloudo Uzoukwu</title>
    <description>The latest articles on DEV Community by Soloudo Uzoukwu (@slidoboss).</description>
    <link>https://dev.to/slidoboss</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F937035%2Fba7a5648-506a-434a-a209-99d3d6b098ad.jpg</url>
      <title>DEV Community: Soloudo Uzoukwu</title>
      <link>https://dev.to/slidoboss</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/slidoboss"/>
    <language>en</language>
    <item>
      <title>Which is best Next.JS or Nuxt.JS</title>
      <dc:creator>Soloudo Uzoukwu</dc:creator>
      <pubDate>Thu, 17 Oct 2024 13:05:32 +0000</pubDate>
      <link>https://dev.to/slidoboss/which-is-best-nextjs-or-nuxtjs-1dm8</link>
      <guid>https://dev.to/slidoboss/which-is-best-nextjs-or-nuxtjs-1dm8</guid>
      <description>&lt;p&gt;The ability to build scalable and seamless web applications quickly is the dream of every web developer. As a result, the importance of frameworks in development cannot be overstated. Over many years, javascript frameworks have come out to achieve this vision; among them are &lt;code&gt;Next.js&lt;/code&gt; and &lt;code&gt;Nuxt.js&lt;/code&gt;. Both frameworks have drastically improved the way web applications are built in recent times through enhancements in performance and user experience, but which is best for your project? In this article, you'll discover many factors that will help guide you and help you come to the proper conclusion. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is Next.js?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Next.js&lt;/code&gt; is an open-source javascript framework developed by Vercel; it was built on &lt;code&gt;React&lt;/code&gt; and is used for building &lt;a href="https://nextjs.org/docs/pages/building-your-application/rendering/server-side-rendering" rel="noopener noreferrer"&gt;server-side rendered&lt;/a&gt; applications and &lt;a href="https://www.staticapps.org/articles/defining-static-web-apps/#:~:text=A%20Static%20Web%20Application%20is,%2C%20CSS%2C%20or%20JavaScript%20content." rel="noopener noreferrer"&gt;static web applications&lt;/a&gt;. &lt;code&gt;Next.js&lt;/code&gt; has grown to be a popular framework among React developers due to its simplicity, versatility and efficiency at building web applications. The framework is relatively easy for new developers using React to pick up , as it bolsters a number of features that help simplify development. A few of those features include;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;File-base routing:&lt;/strong&gt; &lt;code&gt;Next.js&lt;/code&gt; is able to automatically generate routes from files and folders inside the pages directory. This makes routing and navigation easier without the need for additional configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server-Side Rendering(SSR):&lt;/strong&gt; By fetching data and pre-rendering pages on request, content that frequently changes or depends on external data gets loaded quicker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Static Site Generation(SSG):&lt;/strong&gt; &lt;code&gt;Next.js&lt;/code&gt; is able to generate static pages at build time, this makes it fast and highly optimized for search engine optimization (SEO).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hybrid Rendering:&lt;/strong&gt; &lt;code&gt;Next.js&lt;/code&gt; allows different rendering methods to exist within the same project. Different pages can have server-rendering, static rendering, or incremental static rendering, thus making the project more flexible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API Routes:&lt;/strong&gt; This feature grants you the ability to create serverless APIs inside the &lt;code&gt;pages/api&lt;/code&gt; folder. Because these endpoints are serverless, integrating backend features like managing form submissions and user authentication is simple.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Automatic code splitting:&lt;/strong&gt; Better performance and faster load times are achieved because &lt;code&gt;Next.js&lt;/code&gt; automatically divides the &lt;code&gt;JavaScript&lt;/code&gt; bundle by page, loading only the &lt;code&gt;JavaScript&lt;/code&gt; required for each page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Optimized Image Loading:&lt;/strong&gt; Images are automatically optimized in real-time via the next/image component. Depending on the user's device and browser, it optimizes the size of photos, offers them in the proper formats, and lazy loads them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Preview Mode:&lt;/strong&gt; This allows you to fetch unpublished draft content from headless CMS or databases for preview while bypassing static generation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Built-in Analytics:&lt;/strong&gt; The framework comes with Vercel analytics for tracking user interaction, performance monitoring, and core web vitals.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Middleware:&lt;/strong&gt; Middleware in &lt;code&gt;Next.js&lt;/code&gt; enables you to execute code before a request is completed, which is handy for authentication, logging, A/B testing, and changing response headers. It is powerful and operates on the Edge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Built-in Security:&lt;/strong&gt; Several built-in security features of &lt;code&gt;Next.js&lt;/code&gt; include HTTPS enforcement, Content Security Policy (CSP) headers, and secure data handling between client and server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Webpack 5 Integration:&lt;/strong&gt; Webpack 5 is the default builder for &lt;code&gt;Next.js&lt;/code&gt;, which enables quicker builds, better caching, better tree shaking, and compatibility with the most recent Webpack plugins.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Next.js
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Next.js&lt;/code&gt; has a number of benefits that make it an incredible tool for building modern web applications. These include the following;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Next.js&lt;/code&gt; provides you with a ton of flexibility and customizability, with its hybrid rendering capabilities and the ability to define your project's architecture.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's highly optimized for SEO ranking on Google, which enables your site to be easily seen in searches.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's a very popular framework and, as a result, has a ton of resources for learning the ins and outs; it's also easier to debug because people in the community have dealt with most issues.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dynamic content performs better and loads faster because to features like server-side rendering, automatic code splitting, static site creation, and improved picture loading.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;With features that reduce load times and give near instant navigation the overall experience of your users improve significantly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Next.js&lt;/code&gt; gives you a wonderful experience as a developer with its suite of features from file-based rendering, fast refreshing, &lt;code&gt;API&lt;/code&gt; routes and many more. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When deploying &lt;code&gt;Next.js&lt;/code&gt; applications on AWS or Vercel infrastructure management reduces significantly as &lt;code&gt;Next.js&lt;/code&gt; runs API routes and backend functions as serverless services. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Shortcomings of Next.js
&lt;/h2&gt;

&lt;p&gt;Although the framework is packed with benefits, it also carries a number of limitations that you need to be aware of when considering it for your project; a few of them are;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It lacks an in-built state management solution and thus requires third-party solutions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Increased hosting cost due to server-side rendered pages needing servers or serverless functions to run on every request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's not strong enough to handle backend activities such as complex &lt;code&gt;API&lt;/code&gt; interactions and database heavy workloads.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Apps are &lt;code&gt;Javascript&lt;/code&gt; dependent, and as a result, users with JS turned off won't have the whole experience. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Although &lt;code&gt;Next.js&lt;/code&gt; simplifies a ton of processes, Hybrid rendering introduces a number of variables that lead to confusion especially for new &lt;code&gt;React&lt;/code&gt; developer.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is Nuxt.Js?
&lt;/h2&gt;

&lt;p&gt;According to the official developer site, &lt;code&gt;Nuxt.js&lt;/code&gt; is an open-source framework designed to streamline web development, offering an intuitive yet powerful experience. It enables developers to confidently create high-performance, production-ready, full-stack web applications and websites. Built on top of the &lt;code&gt;Vue.js&lt;/code&gt; framework, &lt;code&gt;Nuxt.js&lt;/code&gt; shares many similarities with &lt;code&gt;Next.js&lt;/code&gt; while leveraging modern build tools like Vite and integrating seamlessly with Node.js.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Nuxt.js&lt;/code&gt; has a number of features that make it a standout tool for building modern web applications for Vue developers; they include;  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rendering:&lt;/strong&gt; Just like Next, Nuxt also feature server side rendering, static site generation and hybrid rendering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;State Management:&lt;/strong&gt; The framework comes with VueX, a state management library for &lt;code&gt;Vue.js&lt;/code&gt;, which is the default state management solution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Auto imports:&lt;/strong&gt; Without the need to explicitly import files, any component, assets, or modules available in the &lt;code&gt;components/&lt;/code&gt;, &lt;code&gt;utils/&lt;/code&gt;, and &lt;code&gt;composable/&lt;/code&gt; directories will be automatically imported.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vue Routing:&lt;/strong&gt; Most apps require numerous pages and a method for navigating between them. This is known as routing. Nuxt creates routes mapped to your files using the official &lt;a href="https://router.vuejs.org/" rel="noopener noreferrer"&gt;Vue Router module&lt;/a&gt; based on pages/directory and naming standards.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Modules:&lt;/strong&gt; Nuxt uses a module system that gives it full extensibility. The modules are async functions that are executed sequentially when Nuxt is launched in development mode with &lt;code&gt;nuxi dev&lt;/code&gt; or a production project is built with &lt;code&gt;nuxi build&lt;/code&gt;. They can modify templates, set up webpack loaders, add CSS libraries, and conduct a variety of other essential operations. The best part is that Nuxt modules may be deployed as npm packages. This allows them to be reused between projects and shared with the community, fostering an ecosystem of high-quality add-ons.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Smaller Bundles:&lt;/strong&gt; Nuxt is optimized to make Vue functionalities such as template directives and built-in components tree shakable, this means that if these aren't in use in your project they won't be included thus helping reduce the overall size of the application. &lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Nuxt.js
&lt;/h2&gt;

&lt;p&gt;Nuxt has a number of benefits that make it a prime choice for Vue developers, they are;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It's a great fit for new developers familiar with the Vue. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It prioritizes a conventions over configurations environment, reducing the amount of configurations and letting developers focus more on code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Like Next, Nuxt is also very SEO friendly. Since search engines can efficiently crawl and index website material.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The framework is quite flexible, having hybrid rendering capabilities similar to &lt;code&gt;Next.js&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's a very modular framework with the ability to extend the overall functionality of the framework through the use of modules.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The development process with Nuxt is quite fast because Nuxt comes with a ton of features that do a lot of heavy lifting.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Shortcomings of Nuxt.js
&lt;/h2&gt;

&lt;p&gt;A bunch of benefits for Nuxt were laid out in the previous section but to truly get a grasp of what its like to use the framework here are a few cons.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Nuxt.js&lt;/code&gt; is a relatively less popular framework compared to Next.js in web development, as a result has a smaller but budding community. This translates to fewer documentation and resources by the community and could lead to longer periods spent debugging.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;By prioritizing a conventions over configuration environment, Nuxt makes it quite challenging to integrate custom libraries.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the eventuality your web application gets higher traffic, this can lead to serious strains on the server.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How are Next.js and Nuxt.js similar?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Next.js&lt;/code&gt; and &lt;code&gt;Nuxt.js&lt;/code&gt; are two widely-used frameworks built on top &lt;code&gt;React&lt;/code&gt; and &lt;code&gt;Vue.js&lt;/code&gt; respectively, both designed to simplify and accelerate web application development. These frameworks provide powerful features to enhance developer productivity, optimize application performance, and streamline server-side rendering (SSR), which is crucial for improved SEO. Below are some key similarities between &lt;code&gt;Next.js&lt;/code&gt; and &lt;code&gt;Nuxt.js&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server-Side Rendering (SSR) Support:&lt;/strong&gt; Both frameworks provide robust server-side rendering capabilities out of the box. SSR improves the SEO of your web application by pre-rendering pages on the server, ensuring faster load times and better search engine indexing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Static Site Generation (SSG):&lt;/strong&gt; &lt;code&gt;Next.js&lt;/code&gt; and &lt;code&gt;Nuxt.js&lt;/code&gt; allow for static site generation, a technique that enables pre-rendering pages at build time. This results in faster delivery of static assets, improved performance, and enhanced scalability for content-heavy websites. Both frameworks can serve static and dynamic pages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Routing:&lt;/strong&gt; Both &lt;code&gt;Next.js&lt;/code&gt; and &lt;code&gt;Nuxt.js&lt;/code&gt; simplify routing by using a file-based routing system. With this approach, developers can create pages by simply adding files to the designated pages directory. This eliminates the need for manually configuring routes, making development more intuitive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Component-Based Architecture:&lt;/strong&gt; The component-based architecture of &lt;code&gt;Next.js&lt;/code&gt; (with React) and &lt;code&gt;Nuxt.js&lt;/code&gt; (with Vue) enables developers to deconstruct their user interface into reusable parts. This modular approach leads to more maintainable and scalable code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Automatic Code Splitting:&lt;/strong&gt; Both frameworks automatically split the code into smaller bundles. This ensures that only the necessary code for a given page is loaded, optimizing page load times and overall performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Development Flexibility:&lt;/strong&gt; &lt;code&gt;Next.js&lt;/code&gt; and &lt;code&gt;Nuxt.js&lt;/code&gt; both offer flexibility in terms of deployment. Whether you're building a single-page application (SPA), server-rendered app (SSR), or a statically generated site (SSG), both frameworks support various deployment strategies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Plugin and Middleware Ecosystem:&lt;/strong&gt; Both frameworks support plugins and middleware, allowing for easy customization and extension. Whether you're adding global CSS, managing state, or handling authentication, both &lt;code&gt;Next.js&lt;/code&gt; and &lt;code&gt;Nuxt.js&lt;/code&gt; provide tools and a wide array of third-party plugins.&lt;/p&gt;

&lt;h2&gt;
  
  
  Differences between Next.js and Nuxt.js
&lt;/h2&gt;

&lt;p&gt;While both frameworks share the goal of streamlining the web development process and offer a similar feature set, they take different approaches and each has its own strengths and limitations. These differences can impact your development workflow, productivity, and may ultimately determine which framework is the better fit for your specific needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Framework Foundation&lt;/strong&gt;&lt;br&gt;
At their core, both &lt;code&gt;Next.js&lt;/code&gt; and &lt;code&gt;Nuxt.js&lt;/code&gt; are JavaScript frameworks, but each is built on a different underlying framework. &lt;code&gt;Next.js&lt;/code&gt; is based on &lt;code&gt;React&lt;/code&gt;, while &lt;code&gt;Nuxt.js&lt;/code&gt; is built on &lt;code&gt;Vue.js&lt;/code&gt;. Both &lt;code&gt;React&lt;/code&gt; and &lt;code&gt;Vue.js&lt;/code&gt; are prevalent and widely-used frameworks, choosing between both often comes down to which of the underlying frameworks you're more familiar with. However, if you have a solid grasp of both React and Vue, the choice will likely be driven by personal preference and the specific needs of your project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Support and Community&lt;/strong&gt;&lt;br&gt;
Both frameworks are quite active and popular in the web development community but &lt;code&gt;Next.js&lt;/code&gt; really stands out with over 121,000 stars on github, that's 69,000 more than &lt;code&gt;Nuxt.js&lt;/code&gt;; this is due to the already widespread popularity of React among web developers. As a result Next.js has more resources for learning such as forum posts, tutorials and a wealth of third party libraries. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;State Management&lt;/strong&gt;&lt;br&gt;
For handling state management across a web application, Nuxt comes with it's own built-in state management solution straight out of Vue called VueX, to handle state management with Next you'd need to rely on third-party solutions like Zustand, Redux and MobX as Next lacks a primary solution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Modularity&lt;/strong&gt; &lt;br&gt;
Next does not require a strict directory structure or pre-configured features, allowing developers to create their own architecture. When developing, they can include all of the essential libraries; this makes the framework more versatile than Nuxt, which has more subjective defaults that stress convention over configuration. It is pre-configured with Vuex for state management, SSR, SSG, and file-based routing. Nuxt simplifies development by providing modules that enhance its core features, including analytics, PWA support, and authentication. This modular architecture simplifies feature administration and integration while requiring minimal customization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;br&gt;
For building highly scalable web applications &lt;code&gt;Next.js&lt;/code&gt; is the best choice with its flexibility and customizability allowing developers define their own architecture for projects, it also follows a "smaller updates more frequently" methodologies that ensure that updating your application to the latest version of the framework work happens with ease. Nuxt on the other hand is a great fit for smaller and medium projects. It follows a "convention over configuration" philosophy that makes it easier to get started on a project. Unfortunately it doesn't excel when it comes to large project as it prioritizes "larger updates less frequently", this makes migrating from a previous version to a new one come with some difficulty as applications would often need to be re written from scratch to use a newer version of the framework. &lt;/p&gt;

&lt;h2&gt;
  
  
  Use cases
&lt;/h2&gt;

&lt;p&gt;Both &lt;code&gt;Next.js&lt;/code&gt; and &lt;code&gt;Nuxt.js&lt;/code&gt; are exceptional frameworks for building modern web applications, but choosing between both frameworks depends on your specific use case, they both excel at doing the same thing by taking varying approaches to the problem.&lt;/p&gt;

&lt;h3&gt;
  
  
  When to use Next.js
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;React-Centric projects:&lt;/strong&gt; The best option if you or your team are working in the React ecosystem is &lt;code&gt;Next.js&lt;/code&gt;. When reusing React components or moving current React applications to a framework with integrated SSR and SSG optimizations, it is particularly preferred.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enterprise-Level Applications:&lt;/strong&gt; &lt;code&gt;Next.js&lt;/code&gt; is a fantastic option for enterprise solutions needing complete control over architecture because of its modularity, which enables developers to bring in exactly the libraries and tools they require for large-scale applications with intricate modifications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Highly Custom Web Applications:&lt;/strong&gt; For online projects where flexibility is crucial, &lt;code&gt;Next.js&lt;/code&gt; is the best choice. Developers can freely incorporate unique features like state management programs, custom routing systems, and sophisticated third-party services because it doesn't impose many defaults.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performance-Optimized SEO Projects:&lt;/strong&gt; The SSR and static generation features of &lt;code&gt;Next.js&lt;/code&gt; give developers the means to efficiently improve site speed, SEO, and user experience for websites that require the greatest levels of performance and SEO, like landing pages or portfolios.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  When to use Nuxt.js
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Vue.js-Centric Projects:&lt;/strong&gt; If you're working on a 'Vue.js' application or a team that values Vue's flexibility and simplicity, 'Nuxt.js' is the best solution. It is ideal for projects that are already committed to Vue due to its compatibility with Vue components and the Vue ecosystem.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Server-Side Rendering (SSR) with Minimal Setup:&lt;/strong&gt; SSR is made easier using Nuxt.js's ready-to-use configuration. Nuxt's opinionated structure makes it simple to spin up efficient apps with minimal effort if you require SSR right out of the box without requiring extensive customization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;E-commerce Platforms:&lt;/strong&gt; E-commerce websites that require server-rendered pages for performance and SEO reasons are a good fit for &lt;code&gt;Nuxt.js&lt;/code&gt;. It is effective in integrating crucial e-commerce functionality because of its modular design, which includes pre-built modules (such as authentication and payments).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Content-Heavy Websites:&lt;/strong&gt; Nuxt's static site generation (SSG) features and SEO modules make it an excellent choice for blogs, news sites, and marketing pages. Material-focused apps benefit from Nuxt's ability to pre-fetch material and manage dynamic routes with simplicity.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;There is no definitive answer to which framework is "better"—the choice largely depends on the nature and scope of your project, as well as your expertise. If you have a strong foundation in React, Next.js will likely be the better fit, while those more familiar with Vue.js may prefer Nuxt.js. If you're comfortable with both, consider the scale of your project. With no initial setup needed, Nuxt.js is perfect for rapidly creating simple web applications. Because of its scalability, Next.js really shines in large-scale applications, even though it can manage small projects as well.&lt;/p&gt;

&lt;p&gt;In the end, both frameworks are robust instruments that will assist you in creating effective, high-performing apps.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>learning</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Top 5 game engines for game development in 2023</title>
      <dc:creator>Soloudo Uzoukwu</dc:creator>
      <pubDate>Thu, 23 Feb 2023 23:07:19 +0000</pubDate>
      <link>https://dev.to/slidoboss/top-5-game-engines-for-game-development-in-2023-g9a</link>
      <guid>https://dev.to/slidoboss/top-5-game-engines-for-game-development-in-2023-g9a</guid>
      <description>&lt;p&gt;For new developers looking to venture into a career in video game development or wishing to take up game development as a personal project, this article helps you decide which tool to use on your journey. In addition, this article aims to guide experienced developers who wish to switch career paths to game development on the tool to consider when making their transition. Although the game development space is one to consider carefully, especially for those unfamiliar with software development, developers use specific tools to produce the beautiful projects we enjoy, like Hollow Knight or any Mario game. One example is a game engine, the foundational tool for building these projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Game Engine?
&lt;/h2&gt;

&lt;p&gt;A game engine is computer software packed with many optimized tools to simplify game development. With a game engine, it's possible to simulate real-life physics, render graphics, control sounds and much more depending on the game's needs. In the past, most game development companies had to build custom game engines based on the requirements of the game project. Nowadays, only a few big companies opt to develop custom game engines; the rest rely on third-party software fitted with features that make creating any game relatively easy. &lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of using a third-party game engine
&lt;/h2&gt;

&lt;p&gt;A few companies have created third-party game engines to meet all the requirements for building a large variety of 3D or 2D games. Below are a few ways using a third-party game engine would benefit you as a job-seeking game dev or a solo developer. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Most game studios use one of the game engines mentioned in this article. Therefore, by learning to use one of these tools, you stand a higher chance of getting employed by more companies looking for a competent developer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Suppose you plan on working solo or starting a game studio. In that case, using third-party software is less expensive than building a custom game engine, considering that most third-party game engines are free and only charge you under certain conditions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using a third-party game engine reduces the overall development time since most of the plugins needed for the game's development have already been made available.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Some third-party game engines allow for cross-platform development, enabling you to ship the same project to multiple devices.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Communities built around them constantly develop the game engine since some third-party engines in this article are open source.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  List of Game engines
&lt;/h2&gt;

&lt;p&gt;Many game companies and solo developers choose to use a third-party software, and in this article, we'll list the five best you should consider for development.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.unrealengine.com/en-US" rel="noopener noreferrer"&gt;&lt;strong&gt;1. Unreal Engine 5&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unreal Engine is a compelling game development software that handles development for 3D and 2D games using the C++ programming language. However, it is more suited for making 3D games than 2D games due to its strong graphics capabilities. It's a more popular pick used majorly by big triple-A game studios in the production of photo-realistic games like Injustice 2, the sea of thieves and star wars Jedi: fallen order. The Engine is also kinda open source, allowing the quite sizable community to improve the game engine. It's also a great pick for non-programmers with its visual blueprinting plugin that enables developers to create games without writing lines of code. The Engine has also transcended game development and supports production for several industries, from film to automotive design and architecture. Lastly, it promotes development for many platforms, including Consoles, Desktops, VR and more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://unity.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;2. Unity&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unity is best known for its popularity with the indie game community and its relatively more beginner-friendly design than Unreal Engine. It's a game engine developed by Unity technologies in 2005 and can be utilized to develop 3D and 2D games using the C# programming language. It is known for being used in creating games like Hollow knight, Dead Cells, Genshin Impact and a host of other games on mobile, PC, etc. The sheer number of available material for learning how to use Unity is a result of the enormous community that contributes to developing the software with SDKs and assets. Anyone can use the Engine for more than just game development. It supports production for many industries, from film to automotive design and architecture. With Unity, you'll be able to develop for almost every available gaming device, including VR and AR devices. Unity is free for those opting for a personal plan but has other subscription plans available. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://godotengine.org/en" rel="noopener noreferrer"&gt;&lt;strong&gt;3. Godot&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Godot is a relatively new game engine compared to the previous mentions on this list. The Engine has only been around since 2014; it has just recently been able to gain much popularity among game developers. The software supports 2D and 3D game development but can't produce 3D games with high-fidelity graphics. Godot is completely free and open source allowing for constant updates to be made to the Engine year-round by the budding Godot community. Being a relatively new engine, Godot has less learning material than third-party engines like Unreal and Unity, but it makes up for it by being beginner-friendly through its distinct representation of specific game functions with its node and scene architecture. The chosen language for development in Godot is known as GDScript, but it's also possible to develop games using C#, C++ and visual scripting on the Engine. Again, being relatively new, the Engine has only been used to create a handful of notable releases like Kingdoms of the Dump, Haiki, The Ballad of Bonky and many more. One final thing to note is the Engine currently supports development for Desktop, Web, VR, and Mobile.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gamemaker.io/en" rel="noopener noreferrer"&gt;&lt;strong&gt;4. Game Maker 2&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This no-code Engine supports game development for 2D games using visual scripting. It's a beginner-friendly engine as it enables anyone to make games without proper programming knowledge; It does this through a drag-and-drop method of creating gameplay, allowing for faster prototyping and iteration. In addition, the Engine has a programming language called Game Maker Language for those looking to write custom behaviors that expand beyond the scope of the visual scripting. Unfortunately, game Maker is proprietary software; this implies that the Engine won't get as many advancements from the community as the others and would cost more to acquire a fully equipped version of the software. 2D games using this Engine include Hyper Light drifter, Webbed, Katana zero and Flynn: Son of Crimson.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.construct.net/en/make-games/games-editor" rel="noopener noreferrer"&gt;&lt;strong&gt;5. Construct 3&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The final third-party game engine on the list is Construct 3, a no-code game development software that primarily creates 2D games like Mighty Goose, TeenTitansGO: Attack of the drones and Guinea pig parkour. However, the Engine also has support for light 3D development. As a no-code engine, it primarily relies on visual scripting for creating gameplay logic. It also supports using JavaScript for writing game code, making it easier for beginners and software developers working with JS. One key advantage this Engine has over the rest on the list is its ability to run smoothly on browsers allowing you to develop and test from anywhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The five-game engines mentioned constitute some of the best game development tools currently available; you can ensure each of them delivers on the features they offer. In addition, knowledge of the use of any one of these software will help propel you to a strong career as a game developer. &lt;/p&gt;

</description>
      <category>unity3d</category>
      <category>gamedev</category>
      <category>csharp</category>
      <category>beginners</category>
    </item>
    <item>
      <title>JavaScript XMLHttpRequest (XHR): Part 1</title>
      <dc:creator>Soloudo Uzoukwu</dc:creator>
      <pubDate>Tue, 04 Oct 2022 15:57:47 +0000</pubDate>
      <link>https://dev.to/slidoboss/javascript-xmlhttprequest-xhr-part-1-3gk</link>
      <guid>https://dev.to/slidoboss/javascript-xmlhttprequest-xhr-part-1-3gk</guid>
      <description>&lt;p&gt;User experience is an important factor to put into consideration when building a project. There are so many subtle ways to improve user experience, and minimizing the level of disruption users experience while on a web page is one of them. For example, picture a scenario where a web page must frequently retrieve a particular piece of data from the servers; it would be annoying to the user if the web page does a full page refresh every time it retrieves that data. A way to avoid that is by issuing an XMLHttpRequest. Doing this enables a web page to update just part of a page without unnecessarily interrupting the user. In addition, XMLHttpRequest objects allow data retrieval from a URL without doing a full page refresh. This is because XMLHttpRequest objects are used to interact with servers. &lt;br&gt;
Despite its name, XMLHttpRequest isn't limited to just retrieving XML; it can be utilized to retrieve any type of data.&lt;/p&gt;
&lt;h2&gt;
  
  
  Constructor
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;XMLHttpRequest()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This constructor is used to initialize an XMLHttpRequest and must be called before any other method calls.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;XMLHttpRequest&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Methods
&lt;/h2&gt;

&lt;p&gt;The following Methods have been made available for the XMLHttpRequest object;&lt;/p&gt;

&lt;h4&gt;
  
  
  XMLHttpRequest.open()
&lt;/h4&gt;

&lt;p&gt;This initializes a new request or re-initializes an already existing request. The syntax to use this method is written below;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;open(method, URL)&lt;br&gt;
Open(method, URL, async)&lt;br&gt;
Open(method, URL, async, user)&lt;br&gt;
Open(method, URL, async, user, password)&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  About parameters
&lt;/h5&gt;

&lt;p&gt;Method: &lt;br&gt;
This is the HTTP request method to use, such as “GET”, “POST”, “PUT”, “DELETE”, etc. It can be ignored for none HTTP(S) URLs.&lt;/p&gt;

&lt;p&gt;URL: &lt;br&gt;
A string representing the URL where the request is to be sent.&lt;/p&gt;

&lt;p&gt;Async: &lt;br&gt;
An optional Boolean parameter is set to true by default. It indicates whether or not to run the operation asynchronously. When the value is set to true, a notification of a completed transaction is provided using event listeners. If false, the send() method doesn’t return until the response is received.&lt;/p&gt;

&lt;p&gt;User: &lt;br&gt;
An optional parameter, it's a username used for authentication; by default, this has a null value.&lt;/p&gt;

&lt;p&gt;Password: &lt;br&gt;
An optional parameter, it is a password used for the purpose of authentication. By default, this has a null value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;XMLHttpRequest&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;GET&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;mypage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;

&lt;span class="nx"&gt;Xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  XMLHttpRequest.send()
&lt;/h4&gt;

&lt;p&gt;This method is used to send the request to the server. For an asynchronous request, this method immediately returns the request is shipped, and its result is delivered using events. For a synchronous request, the method doesn't return until the response has arrived. The syntax to use this method is written below;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;send()&lt;br&gt;
send(body)&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  About parameters
&lt;/h5&gt;

&lt;p&gt;Body: &lt;br&gt;
An optional parameter sent in the XHR request that specifies the request's body, it's mainly used if request method is "GET” or “HEAD”. This can be &lt;/p&gt;

&lt;p&gt;•A document, in this case, serialization, is done before being sent.&lt;br&gt;
•An XMLHttpRequestInit, which could be a blob, an array buffer, a typed array, a data view, a form data, a URLSearchParams, a string literal or an object as per the Fetch specs.&lt;br&gt;
•Or null(used by default if no value is specified).&lt;/p&gt;

&lt;p&gt;On a side note, the best way to send binary content is using a blob, typed array or data view combined with the send() method.&lt;/p&gt;
&lt;h5&gt;
  
  
  GET request
&lt;/h5&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;XMLHttpRequest&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;GET&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;webserver&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; 
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Request finished. Do processing here.&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;string&lt;/span&gt; &lt;span class="nx"&gt;literal&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// xhr.send(document);&lt;/span&gt;
&lt;span class="c1"&gt;// xhr.send(null)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h5&gt;
  
  
  POST request
&lt;/h5&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;XMLHttpRequest&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;webserver&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;//Send the correct header information with the request&lt;/span&gt;
&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setRequestHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/x-www-dummy-file&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onreadystatechange&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;

 &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// Call a function when the state changes.&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;readyState&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;XMLHttpRequest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DONE&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
   &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Request finished. Do processing here.&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;lasgidi==loreunknown&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// xhr.send(new Int8Array());&lt;/span&gt;
&lt;span class="c1"&gt;// xhr.send(document);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  XMLHttpRequest.abort()
&lt;/h4&gt;

&lt;p&gt;This method aborts an already sent request. When a request is aborted, its ready state changes to XMLHttpRequest.UNSENT(0), and the request's status code is set to zero. The method syntax is written below;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;abort()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Example code illustrating the abort() method in use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;XMLHttpRequest&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://www.google.com/docs/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CANCEL_NOW&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  XMLHttpRequest.getResponseHeader()
&lt;/h4&gt;

&lt;p&gt;Returns a string containing a particular header's text value. In a scenario where multiple headers have the same name, their values are returned as a single concatenated string, where values are separated from each other by a pair of commas and spaces. The getResponseHeader() method returns  a UTF byte sequence as its value.   &lt;/p&gt;

&lt;p&gt;&lt;code&gt;getResponseHeader(headerName)&lt;/code&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  About parameters
&lt;/h5&gt;

&lt;p&gt;headerName:&lt;br&gt;
This is a string indicating the name of the desired header to return its text value. If the header is non-existent or hasn’t been received, it returns null.&lt;/p&gt;

&lt;p&gt;Let's have an example where a request is created and sent, and a readystatechange handler is established to look for readyState to show whether the headers were received. In this case, the value of the Content-Type header is fetched. If the Content-Type isn't the desired value, the XMLHttpRequest is cancelled by calling abort()&lt;/p&gt;

&lt;p&gt;This code illustrates the use of the getResponseHeader() method;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;XMLHttpRquest&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;GET&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;dummypage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onreadystatchange&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nc"&gt;If&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;readyState&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;HEADER_RECEIVED&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;contentType&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getResponseHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;Content&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;Type&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  
        &lt;span class="nc"&gt;If&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;contentType&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nx"&gt;my_expected_type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  XMLHttpRequest.getAllResponseHeaders()
&lt;/h4&gt;

&lt;p&gt;Returns a string containing all the response headers separated by CRLF or returns null if no response has been received. If a network error occurs, an empty string is returned.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;getAllResponseHeaders()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This codeblock illustrates the use of the getAllResponseHeader() method;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;XMLHttpRequest&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;allResponseHeaders&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAllResponseHeaders&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;  

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;allResponseHeaders&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="p"&gt;{&lt;/span&gt;   
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  
   &lt;span class="p"&gt;}&lt;/span&gt; 
&lt;span class="k"&gt;else&lt;/span&gt;
   &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;headers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;allResponseHeaders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;headerNames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;  
      &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
          &lt;span class="p"&gt;{&lt;/span&gt;   
              &lt;span class="nx"&gt;headerNames&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 
              &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;headerNames&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
          &lt;span class="p"&gt;}&lt;/span&gt;  
    &lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  XMLHttpRequest.setRequestHeader()
&lt;/h4&gt;

&lt;p&gt;This method is used to set the value of an HTTP request header. When using this method, the open() method must be called first, and then the send() method can be called after the setRequestHeader method call. In the case where this method is being called multiple times with the same header, the values are simply merged together in one single request header.&lt;/p&gt;

&lt;p&gt;Each time a setRequestHeader() method call is initiated, after the first call, the specified text is affixed to the end of the existing header’s content.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;setRequestHeader(header, value)&lt;/code&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  About parameters
&lt;/h5&gt;

&lt;p&gt;Header:&lt;br&gt;
Name of the header whose values are set.&lt;/p&gt;

&lt;p&gt;Value:&lt;br&gt;
The value is set as the body of the header.&lt;/p&gt;

&lt;p&gt;This code block illustrates the use of the setRequestHeader() method to delete a file created at a random date;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;XMLHttpRequest&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;deleteJSON&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;application&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;call&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;call&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;callBack&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nb"&gt;Function&lt;/span&gt; &lt;span class="nf"&gt;callBack&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; 
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;demo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;responseText&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;deleteJSON&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cb&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;DELETE&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setRequestHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;authorization&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  XMLHttpRequest.overrideMimeType()
&lt;/h4&gt;

&lt;p&gt;This method is used to override the MIME type provided by the server.&lt;/p&gt;

&lt;p&gt;overrideMimeType(mimeType)&lt;/p&gt;

&lt;h5&gt;
  
  
  About parameters
&lt;/h5&gt;

&lt;p&gt;mimeType:&lt;br&gt;
A string thats overrides the MIME type used instead of the server-specified one. If a type is unspecified, XMLHttpRequest assumes "text/XML".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="c1"&gt;//this code interprets the received data as plain text&lt;/span&gt;
&lt;span class="nx"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;XMLHttpRequest&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;overrideMimeType&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text/plain&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;load&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Variables and Datatypes</title>
      <dc:creator>Soloudo Uzoukwu</dc:creator>
      <pubDate>Tue, 04 Oct 2022 15:25:40 +0000</pubDate>
      <link>https://dev.to/slidoboss/variables-and-datatypes-4ajk</link>
      <guid>https://dev.to/slidoboss/variables-and-datatypes-4ajk</guid>
      <description>&lt;p&gt;Variables and datatypes form the core building blocks of any programming language. This article aims to educate you on a few key concepts involving variables and datatypes in JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Variable?
&lt;/h2&gt;

&lt;p&gt;In JavaScript, a variable is simply referred to as a data container or a storage location for data. A good analogy would be to picture variables as pots used to hold different types of food. Variables in JavaScript are known to be loosely typed; this means that a data type does not need to be declared, and any literal value can be assigned to any variable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Variable declaration
&lt;/h3&gt;

&lt;p&gt;Declaring a variable in JavaScript is the act of creating one. Variables can be declared using one of two keywords, &lt;strong&gt;"let"&lt;/strong&gt; and &lt;strong&gt;"const"&lt;/strong&gt; these words are used before the variable name to define block scope. The let keyword is used to specify that a variable being declared is unrestricted, implying that the data stored in it is changeable. In contrast, the &lt;strong&gt;"const"&lt;/strong&gt; keyword is used to indicate that the variable is restricted and that whatever data it contains can not be changed. &lt;/p&gt;

&lt;h3&gt;
  
  
  Multiple Variable declarations
&lt;/h3&gt;

&lt;p&gt;It is possible to see a line of code having many variables declared in one statement. This is done by using a comma after each variable. &lt;/p&gt;

&lt;p&gt;For example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;sonName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;boy&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dadName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Kratos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;strength&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Variable Identifiers
&lt;/h3&gt;

&lt;p&gt;These are unique names given to variables, and there are general guidelines that make for better practice when writing these names. They are;&lt;/p&gt;

&lt;p&gt;•Variable names should start with a letter (a to z or A to Z),&lt;br&gt;
•The camel case naming convention is strongly recommended (e.g. newValue).&lt;br&gt;
•The use of underscore( _ ), or dollar( $ ) sign is only permitted at the beginning of the variable name(e.g _headcount, _studentName)&lt;br&gt;
•The use of numbers in naming is only allowed at the end of the name and not at the start or any other location(e.g. value2, entry7)&lt;br&gt;
•JavaScript variables are case-sensitive; for example, x and X are different variables.&lt;br&gt;
•Keywords used in JavaScript can not be used as names.&lt;/p&gt;
&lt;h3&gt;
  
  
  JavaScript Reserved Words
&lt;/h3&gt;

&lt;p&gt;A list of all the reserved words in JavaScript is given in the following table. They cannot be used as JavaScript variables, functions, methods, loop labels, or object names.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;abstract&lt;/td&gt;
&lt;td&gt;else&lt;/td&gt;
&lt;td&gt;instanceof&lt;/td&gt;
&lt;td&gt;switch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;boolean&lt;/td&gt;
&lt;td&gt;enum&lt;/td&gt;
&lt;td&gt;int&lt;/td&gt;
&lt;td&gt;synchronized&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;break&lt;/td&gt;
&lt;td&gt;export&lt;/td&gt;
&lt;td&gt;interface&lt;/td&gt;
&lt;td&gt;this&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;byte&lt;/td&gt;
&lt;td&gt;extends&lt;/td&gt;
&lt;td&gt;long&lt;/td&gt;
&lt;td&gt;throw&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;case&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;td&gt;native&lt;/td&gt;
&lt;td&gt;throws&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;catch&lt;/td&gt;
&lt;td&gt;final&lt;/td&gt;
&lt;td&gt;new&lt;/td&gt;
&lt;td&gt;transient&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;char&lt;/td&gt;
&lt;td&gt;finally&lt;/td&gt;
&lt;td&gt;null&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;class&lt;/td&gt;
&lt;td&gt;float&lt;/td&gt;
&lt;td&gt;package&lt;/td&gt;
&lt;td&gt;try&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;const&lt;/td&gt;
&lt;td&gt;for&lt;/td&gt;
&lt;td&gt;private&lt;/td&gt;
&lt;td&gt;typeof&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;continue&lt;/td&gt;
&lt;td&gt;function&lt;/td&gt;
&lt;td&gt;protected&lt;/td&gt;
&lt;td&gt;var&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;debugger&lt;/td&gt;
&lt;td&gt;goto&lt;/td&gt;
&lt;td&gt;public&lt;/td&gt;
&lt;td&gt;void&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;default&lt;/td&gt;
&lt;td&gt;if&lt;/td&gt;
&lt;td&gt;return&lt;/td&gt;
&lt;td&gt;volatile&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;delete&lt;/td&gt;
&lt;td&gt;implements&lt;/td&gt;
&lt;td&gt;short&lt;/td&gt;
&lt;td&gt;while&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;do&lt;/td&gt;
&lt;td&gt;import&lt;/td&gt;
&lt;td&gt;static&lt;/td&gt;
&lt;td&gt;with&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;double&lt;/td&gt;
&lt;td&gt;in&lt;/td&gt;
&lt;td&gt;super&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Types of Variables
&lt;/h3&gt;

&lt;p&gt;Below you’ll discover there are two types of Variables.&lt;br&gt;
•Global Variables&lt;br&gt;
•Local Variables&lt;/p&gt;

&lt;p&gt;Global variables are variables declared outside any function in the JavaScript code; they can be accessed from any function or part of the code.&lt;/p&gt;

&lt;p&gt;Local variables are restricted to the functions where they were declared; a local variable is not accessible from anywhere and can only be used within the function it declared.&lt;/p&gt;
&lt;h3&gt;
  
  
  Variable Initialization
&lt;/h3&gt;

&lt;p&gt;Variables are initialized by assigning data to them; this is done using the assignment operator(=). It can be done from inside or outside a function. In addition, different types of data can be assigned to a variable. &lt;/p&gt;
&lt;h3&gt;
  
  
  Variable use Cases
&lt;/h3&gt;

&lt;p&gt;Aside from data storage, variables are used to do other things in JavaScript. Their use in arithmetic operations can not be understated. Variables holding a string data type can also be concatenated using the plus (+) operator. Variables can also have functions stored in them.&lt;/p&gt;
&lt;h2&gt;
  
  
  Data types
&lt;/h2&gt;

&lt;p&gt;Programming languages have a set of data that is supported. For example, in JavaScript, there are two types, primitive and object values.&lt;/p&gt;

&lt;p&gt;Primitive values include;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Numbers can either be integers or doubles. An integer is represented as a whole number, while doubles include decimals.&lt;/li&gt;
&lt;li&gt;Strings, which are combinations of character values, represent text. When writing a string in JavaScript, the string characters are enclosed between two quotes, two double quotes or two backticks.&lt;/li&gt;
&lt;li&gt;Boolean, these only have two values, true and false.
&lt;/li&gt;
&lt;li&gt;Null returns the value null when used; the value null is assigned to reset a variable by emptying it.&lt;/li&gt;
&lt;li&gt;Undefined, a variable returns the value undefined when a value has not been assigned to it.&lt;/li&gt;
&lt;li&gt;NaN(Not a Number) is commonly encountered as the result of an arithmetic operation done with the use of non-number values. It is also the only datatype in JavaScript that does not equal itself.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Object values include;&lt;/p&gt;

&lt;p&gt;Objects are a collection of properties. The object literal syntax can add or remove properties from the object. Properties can be of type number, string, boolean or other objects.&lt;/p&gt;
&lt;h3&gt;
  
  
  Declaring and Initializing an Object
&lt;/h3&gt;

&lt;p&gt;Declaring an object in JavaScript is done using either a &lt;strong&gt;"let"&lt;/strong&gt; or &lt;strong&gt;"const"&lt;/strong&gt; keyword followed by the identifier, an assignment operator and two curly braces. All the properties are added in the curly braces by assigning data to a key, each key in the object is separated by a comma and values are assigned using a colon instead of an equal sign.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;shoppingBag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;itemName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="nx"&gt;Stockfish&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;itemPrice&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="nx"&gt;Naira&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Arrays, an array is a unique variable that serves as a list for storing multiple values under the same name.&lt;/p&gt;

&lt;h3&gt;
  
  
  Declaring arrays and initializing an array
&lt;/h3&gt;

&lt;p&gt;To declare an array, use the &lt;strong&gt;“let”&lt;/strong&gt; or &lt;strong&gt;“const”&lt;/strong&gt; keyword followed by the identifier, an assignment operator and an opening and closing square bracket.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bodyCount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are multiple ways to initialize an array, one of which is by assigning the data directly to the specified index in the array the syntax looks like so.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;bodycount&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another way to initialize an array is by using the push method provided by JavaScript. The data added to the array is put in between braces as parameters. This initialization method adds an element to the following index after the last element in the list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;bodyCount&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
