Sunday , February 5 2023
Breaking News

## How to swap two numbers without using a temporary variable?

Solution – 1 – Using Arithmetic Operators function swapNumb(a, b){ console.log('Before swap Output: ','a: ', a, 'b: ', b); b = b -a; a = a+ b; b = a-b; console.log('After swap Output: ','a: ', a, 'b: ', b); } swapNumb(2, 3); Solution – 2 – Using Bitwise XOR function …

## How to Create and get nth Fibonacci series number?

What is the Fibonacci series? Fibonacci series is the series of numbers that are calculated by adding the values of the previous two numbers in the sequence. The first two numbers of the sequence are zero and one. It is also known as the golden ratio. We can represent the …

## Simple JavaScript code in promises.

function promiseExample(){ const promise = new Promise((resolve, reject) =>{ resolve('successfully!'); }) .then((resolve) => console.log(resolve)) .catch((reject) => console.log(reject)); return promise; } promiseExample() I have a create simple code example for promises. you can easily check. how to resolve is working? and how to reject is working?

## How to fetch API Data from API in React Using useEffect?

import React, { useState, useEffect } from "react"; // Use can use css from this file: import "./styles.css"; const url = "https://jsonplaceholder.typicode.com/posts"; function App() { const [userData, setUserData] = useState({}); const getUserData = async () => { const response = await fetch(url); const jsonData = await response.json(); setUserData(jsonData); }; useEffect(() …