<?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: Rohit</title>
    <description>The latest articles on DEV Community by Rohit (@rohiitbagal).</description>
    <link>https://dev.to/rohiitbagal</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%2F1280991%2F6fca70c1-1b3f-47d3-96f1-2eb94a8c4a50.jpg</url>
      <title>DEV Community: Rohit</title>
      <link>https://dev.to/rohiitbagal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rohiitbagal"/>
    <language>en</language>
    <item>
      <title>Looking for the dev community especially sofware developer for developing my skills ...</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Thu, 26 Dec 2024 18:03:12 +0000</pubDate>
      <link>https://dev.to/rohiitbagal/looking-for-the-dev-community-especially-sofware-developer-for-developing-my-skills--612</link>
      <guid>https://dev.to/rohiitbagal/looking-for-the-dev-community-especially-sofware-developer-for-developing-my-skills--612</guid>
      <description>&lt;p&gt;Hello all i am pursing Btech degree in computer now i am in the final year looking for the community for building and growing the my skills ...looking forward to teach me and get oppourtunity to me .....&lt;/p&gt;

</description>
      <category>learning</category>
      <category>career</category>
      <category>mentorship</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Pattern Printing</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Tue, 13 Aug 2024 01:52:20 +0000</pubDate>
      <link>https://dev.to/rohiitbagal/pattern-printing-bik</link>
      <guid>https://dev.to/rohiitbagal/pattern-printing-bik</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
using namespace std;
int main() {
    // Write C++ code here
   int n=5;
   for(int row=1;row&amp;lt;=n;row++){
       for(int space =1;space&amp;lt;=row;space++){
           cout&amp;lt;&amp;lt;" ";
       }
       for(int col=1;col&amp;lt;=n-row+1;col++){
           cout&amp;lt;&amp;lt;"* ";
       }
       cout&amp;lt;&amp;lt;endl;
   }
   for(int row=1;row&amp;lt;=n;row++){
       for(int space =1;space&amp;lt;=n-row;space++){
           cout&amp;lt;&amp;lt;" ";
       }
       for(int col=1;col&amp;lt;=row;col++){
           cout&amp;lt;&amp;lt;" *";
       }
       cout&amp;lt;&amp;lt;endl;
   }

    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Learning New Things</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Fri, 19 Apr 2024 18:32:16 +0000</pubDate>
      <link>https://dev.to/rohiitbagal/learning-new-things-2m4o</link>
      <guid>https://dev.to/rohiitbagal/learning-new-things-2m4o</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9m70vpiyicrkw0i43l0j.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9m70vpiyicrkw0i43l0j.jpg" alt="Image description" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Map,Reduce,For-each Loops in js</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Tue, 16 Apr 2024 13:10:21 +0000</pubDate>
      <link>https://dev.to/rohiitbagal/mapreducefor-each-loops-in-js-1e2p</link>
      <guid>https://dev.to/rohiitbagal/mapreducefor-each-loops-in-js-1e2p</guid>
      <description>&lt;p&gt;&lt;strong&gt;Reduce:&lt;/strong&gt;&lt;br&gt;
The reduce() function iterates over the elements of an array and accumulates a single result by applying a provided function against an accumulator and each element in the array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const numbers = [1, 2, 3, 4, 5];
const sum = numbers.reduce((accumulator, currentValue) =&amp;gt; accumulator + currentValue, 0);
console.log(sum); // Output: 15
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Industry Scenario:&lt;/strong&gt; Consider an e-commerce platform where you need to calculate the total price of items in a shopping cart. You have an array of objects representing each item with properties like price and quantity. You can use reduce() to sum up the total price:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const cartItems = [
  { name: 'Shirt', price: 20, quantity: 2 },
  { name: 'Pants', price: 30, quantity: 1 },
  { name: 'Shoes', price: 50, quantity: 1 }
];

const totalPrice = cartItems.reduce((total, item) =&amp;gt; total + (item.price * item.quantity), 0);
console.log(totalPrice); // Output: 120
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;ForEach:&lt;/strong&gt;&lt;br&gt;
The forEach() function executes a provided function once for each array element.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const numbers = [1, 2, 3, 4, 5];
numbers.forEach(number =&amp;gt; console.log(number));
// Output:
// 1
// 2
// 3
// 4
// 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Industry Scenario: Consider a scenario in a project management tool where you want to update the status of each task in a list. You can use forEach() to iterate through the array of tasks and update their status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const tasks = [
  { id: 1, name: 'Task 1', status: 'Pending' },
  { id: 2, name: 'Task 2', status: 'InProgress' },
  { id: 3, name: 'Task 3', status: 'Pending' }
];

tasks.forEach(task =&amp;gt; {
  if (/* condition for updating status */) {
    task.status = 'Completed';
  }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;reduce()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const cartItems = [
  { name: 'Shirt', price: 20, quantity: 2 },
  { name: 'Pants', price: 30, quantity: 1 },
  { name: 'Shoes', price: 50, quantity: 1 }
];

const totalPrice = cartItems.reduce((total, item) =&amp;gt; total + (item.price * item.quantity), 0);
console.log(totalPrice); // Output: 120 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Promices and Async Await</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Tue, 16 Apr 2024 03:44:38 +0000</pubDate>
      <link>https://dev.to/rohiitbagal/promices-and-async-await-2p0k</link>
      <guid>https://dev.to/rohiitbagal/promices-and-async-await-2p0k</guid>
      <description>&lt;p&gt;&lt;strong&gt;Promises in JavaScript:&lt;/strong&gt;&lt;br&gt;
Promises are objects representing the eventual completion or failure of an asynchronous operation. They are widely used in JavaScript for handling asynchronous operations such as fetching data from a server, reading files, or any other operations that take time to complete.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario: Fetching Data from an API&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Suppose you have an application where you need to fetch data from an API. You can use promises to handle the asynchronous nature of this operation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
// Example function to fetch data from an API using promises
function fetchData(url) {
  return new Promise((resolve, reject) =&amp;gt; {
    fetch(url)
      .then(response =&amp;gt; {
        if (!response.ok) {
          throw new Error('Network response was not ok');
        }
        return response.json();
      })
      .then(data =&amp;gt; {
        resolve(data);
      })
      .catch(error =&amp;gt; {
        reject(error);
      });
  });
}

// Usage
fetchData('https://api.example.com/data')
  .then(data =&amp;gt; {
    console.log('Data:', data);
  })
  .catch(error =&amp;gt; {
    console.error('Error:', error);
  });

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

&lt;/div&gt;



&lt;p&gt;In this example:&lt;/p&gt;

&lt;p&gt;The fetchData function returns a promise that resolves with the fetched data or rejects with an error.&lt;br&gt;
We handle the resolution and rejection of the promise using .then() and .catch() respectively.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Async/Await in JavaScript:&lt;/strong&gt;&lt;br&gt;
Async/await is a modern approach for writing asynchronous code in a synchronous-looking manner. It provides a syntactic sugar on top of promises, making asynchronous code easier to read and write.&lt;/p&gt;

&lt;p&gt;Scenario: Fetching Data from an API Using Async/Await&lt;/p&gt;

&lt;p&gt;Let's rewrite the previous example using async/await:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Example function to fetch data from an API using async/await
async function fetchData(url) {
  try {
    const response = await fetch(url);
    if (!response.ok) {
      throw new Error('Network response was not ok');
    }
    const data = await response.json();
    return data;
  } catch (error) {
    throw error;
  }
}

// Usage
async function getData() {
  try {
    const data = await fetchData('https://api.example.com/data');
    console.log('Data:', data);
  } catch (error) {
    console.error('Error:', error);
  }
}

getData();

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;In this example:&lt;/strong&gt;&lt;br&gt;
The fetchData function is declared as async, indicating that it returns a promise implicitly.&lt;br&gt;
We use await to pause the execution of the function until the promise returned by fetch resolves.&lt;br&gt;
The getData function is also declared as async, allowing us to use await inside it to wait for the asynchronous operation to complete.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Differences in Industry Example&lt;/strong&gt;:&lt;br&gt;
Readability and Maintainability:&lt;/p&gt;

&lt;p&gt;Promises: While promises provide a good way to handle asynchronous operations, the code can become nested and less readable when dealing with multiple asynchronous calls.&lt;br&gt;
Async/Await: Async/Await simplifies the code structure by making it look more synchronous, thus enhancing readability and maintainability, especially when dealing with complex asynchronous operations.&lt;br&gt;
Error Handling:&lt;/p&gt;

&lt;p&gt;Promises: Error handling in promises is done using .catch() at the end of the promise chain, which can lead to scattered error handling logic.&lt;br&gt;
Async/Await: Error handling in async/await is done using try/catch blocks, which makes it easier to handle errors locally within the asynchronous function, leading to more organized error handling.&lt;br&gt;
Sequential Execution:&lt;/p&gt;

&lt;p&gt;Promises: Promises are executed sequentially within the promise chain, which can sometimes lead to less intuitive code when dealing with multiple asynchronous operations.&lt;br&gt;
Async/Await: Async/Await allows for a more sequential execution of asynchronous operations, making the code easier to understand and maintain, especially for developers who are more familiar with synchronous programming.****&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>For development you must know some website</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Wed, 10 Apr 2024 08:14:27 +0000</pubDate>
      <link>https://dev.to/rohiitbagal/for-development-you-must-know-some-website-3718</link>
      <guid>https://dev.to/rohiitbagal/for-development-you-must-know-some-website-3718</guid>
      <description>&lt;p&gt;1.React : &lt;br&gt;
&lt;a href="https://react.dev/" rel="noopener noreferrer"&gt;React&lt;/a&gt; &lt;br&gt;
&lt;a href="https://www.w3schools.com/REACT/DEFAULT.ASP" rel="noopener noreferrer"&gt;gfg&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_getting_started" rel="noopener noreferrer"&gt;MDN&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/facebook/create-react-app" rel="noopener noreferrer"&gt;IN Git&lt;/a&gt;&lt;br&gt;
&lt;a&gt;REDUX&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;for pacakges
&lt;a href="https://www.npmjs.com/package/react" rel="noopener noreferrer"&gt;NPM&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;3.IN youtube:&lt;br&gt;
1.chain Aur Code,&lt;br&gt;
2.CODE WITH Harry&lt;br&gt;
3.Apna College&lt;br&gt;
4.Unacadmy&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Promise in Javascript</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Wed, 10 Apr 2024 05:41:15 +0000</pubDate>
      <link>https://dev.to/rohiitbagal/promise-in-javascript-120p</link>
      <guid>https://dev.to/rohiitbagal/promise-in-javascript-120p</guid>
      <description>&lt;p&gt;Description&lt;br&gt;
A Promise is a proxy for a value not necessarily known when the promise is created. It allows you to associate handlers with an asynchronous action's eventual success value or failure reason. This lets asynchronous methods return values like synchronous methods: instead of immediately returning the final value, the asynchronous method returns a promise to supply the value at some point in the future.&lt;/p&gt;



&lt;p&gt;A Promise is in one of these states:&lt;/p&gt;

&lt;p&gt;While a Promise object is "pending" (working), the result is undefined.&lt;br&gt;
When a Promise object is "fulfilled", the result is a value.&lt;br&gt;
When a Promise object is "rejected", the result is an error object.&lt;/p&gt;

&lt;p&gt;myPromise.state myPromise.result :&lt;br&gt;
"pending"  -&amp;gt;   undefined&lt;br&gt;
"fulfilled" -&amp;gt;  a result value&lt;br&gt;
"rejected"  -&amp;gt;  an error object&lt;/p&gt;

&lt;p&gt;Exmample :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Promises](function myDisplayer(some) {
  document.getElementById("demo").innerHTML = some;
}

let myPromise = new Promise(function(myResolve, myReject) {
  let x = 0;

// The producing code (this may take some time)

  if (x == 0) {
    myResolve("OK");
  } else {
    myReject("Error");
  }
});

myPromise.then(
  function(value) {myDisplayer(value);},
  function(error) {myDisplayer(error);}
);)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>node</category>
    </item>
    <item>
      <title>#some important packages of Express</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Thu, 04 Apr 2024 01:31:04 +0000</pubDate>
      <link>https://dev.to/rohiitbagal/some-important-packages-of-express-66j</link>
      <guid>https://dev.to/rohiitbagal/some-important-packages-of-express-66j</guid>
      <description>&lt;p&gt;1.nodemon&lt;br&gt;
nodemon is a tool that helps develop Node.js based applications by automatically restarting the node application when file changes in the directory are detected.&lt;/p&gt;

&lt;p&gt;nodemon does not require any additional changes to your code or method of development. nodemon is a replacement wrapper for node. To use nodemon, replace the word node on the command line when executing your script.&lt;/p&gt;

&lt;p&gt;Installation&lt;br&gt;
Either through cloning with git or by using npm (the recommended way):&lt;br&gt;
npm install -g nodemon # or using yarn: yarn global add nodemon&lt;/p&gt;

&lt;p&gt;2.morgan&lt;br&gt;
NPM Version NPM Downloads Build Status Test Coverage&lt;/p&gt;

&lt;p&gt;HTTP request logger middleware for node.js&lt;/p&gt;

&lt;p&gt;Named after Dexter, a show you should not watch until completion.&lt;/p&gt;

&lt;p&gt;API&lt;br&gt;
var morgan = require('morgan')&lt;br&gt;
morgan(format, options)&lt;br&gt;
Create a new morgan logger middleware function using the given format and options. The format argument may be a string of a predefined name (see below for the names), a string of a format string, or a function that will produce a log entry.&lt;/p&gt;

&lt;p&gt;The format function will be called with three arguments tokens, req, and res, where tokens is an object with all defined tokens, req is the HTTP request and res is the HTTP response. The function is expected to return a string that will be the log line, or undefined / null to skip logging.&lt;/p&gt;

&lt;p&gt;3.mongoose&lt;br&gt;
TypeScript icon, indicating that this package has built-in type declarations&lt;/p&gt;

&lt;p&gt;Mongoose&lt;br&gt;
Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Mongoose supports Node.js and Deno (alpha).&lt;/p&gt;

&lt;p&gt;Build Status NPM version Deno version Deno popularity&lt;/p&gt;

&lt;p&gt;npm&lt;/p&gt;

&lt;p&gt;Documentation&lt;br&gt;
The official documentation website is mongoosejs.com.&lt;/p&gt;

&lt;p&gt;Mongoose 8.0.0 was released on October 31, 2023. You can find more details on backwards breaking changes in 8.0.0 on our docs site.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>express</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>#Node js Debugger</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Wed, 03 Apr 2024 16:55:48 +0000</pubDate>
      <link>https://dev.to/rohiitbagal/node-js-debugger-41mo</link>
      <guid>https://dev.to/rohiitbagal/node-js-debugger-41mo</guid>
      <description>&lt;p&gt;Here are some ways to debug in Node.js:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Use the built-in debugger.&lt;br&gt;
The Node.js built-in debugger is a simple but effective tool for debugging your code. To use it, simply add the debugger keyword to the line of code where you want to start debugging. When you run your code, the debugger will pause at that line and you can use the node debugger commands to step through your code, inspect variables, and set breakpoints.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use the Chrome DevTools debugger.&lt;br&gt;
The Chrome DevTools debugger is a more powerful debugger that can be used to debug Node.js code running in Chrome. To use it, start your Node.js code with the --inspect flag. Then, open Chrome and go to chrome://inspect/. You should see a list of Node.js processes that are running. Click on the process that you want to debug and the Chrome DevTools debugger will open.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use a third-party debugger.&lt;br&gt;
There are a number of third-party debuggers that can be used to debug Node.js code. Some popular options include Visual Studio Code, WebStorm, and IntelliJ IDEA. These debuggers offer a variety of features that can make debugging your code easier, such as breakpoints, step-through debugging, and variable inspection.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here are some additional tips for debugging Node.js code:&lt;/p&gt;

&lt;p&gt;Use console.log() statements to print out the values of variables.&lt;br&gt;
This can be helpful for tracking down the source of a bug.&lt;br&gt;
Use breakpoints to pause your code at specific points.&lt;br&gt;
This can be helpful for inspecting the values of variables or stepping through your code line by line.&lt;br&gt;
Use a debugger to step through your code line by line.&lt;br&gt;
This can be helpful for understanding how your code is executing and finding the source of a bug.&lt;br&gt;
Use a debugger to inspect the values of variables.&lt;br&gt;
This can be helpful for understanding the state of your code and finding the source of a bug.&lt;em&gt;&lt;u&gt;&lt;a href="https://dev.tourl"&gt;&lt;/a&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>how can i take props as image in src please can you explain</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Wed, 03 Apr 2024 16:26:17 +0000</pubDate>
      <link>https://dev.to/rohiitbagal/how-can-i-take-props-as-image-in-src-please-can-you-explain-4249</link>
      <guid>https://dev.to/rohiitbagal/how-can-i-take-props-as-image-in-src-please-can-you-explain-4249</guid>
      <description></description>
    </item>
  </channel>
</rss>
