<?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: Om Bhusal</title>
    <description>The latest articles on DEV Community by Om Bhusal (@ombhusal).</description>
    <link>https://dev.to/ombhusal</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%2F780286%2F095f6ee6-8d62-42e5-b162-c97c6202bdb9.jpeg</url>
      <title>DEV Community: Om Bhusal</title>
      <link>https://dev.to/ombhusal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ombhusal"/>
    <language>en</language>
    <item>
      <title>How to Detect Browser in JavaScript</title>
      <dc:creator>Om Bhusal</dc:creator>
      <pubDate>Thu, 11 Aug 2022 19:14:46 +0000</pubDate>
      <link>https://dev.to/ombhusal/how-to-detect-browser-in-javascript-5fe</link>
      <guid>https://dev.to/ombhusal/how-to-detect-browser-in-javascript-5fe</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m-LZ-Na7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jzudbqxb368wrhcz4ul7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m-LZ-Na7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jzudbqxb368wrhcz4ul7.png" alt="Image description" width="880" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hey friends, Welcome to &lt;a href="https://codewithnepal.com/"&gt;&lt;em&gt;CodeWithNepal&lt;/em&gt;&lt;/a&gt; today in this blog you’ll learn How to build &lt;a href="https://codewithnepal.com/how-to-detect-browser-in-javascript/"&gt;&lt;strong&gt;Browser Detector&lt;/strong&gt;&lt;/a&gt; in JavaScript. To detect user browser, I’ll use only HTML CSS &amp;amp; JavaScript. In the earlier blog, I shared Word Guessing Game and now it’s time to create a simple program that detects browsers in JavaScript.&lt;/p&gt;

&lt;p&gt;In this small project ( Detect Browser ), as you can see withinside the preview image of the project, there’s a ‘Browser’ textual content with special browser trademarks Google Chrome, Mozilla Firefox, Microsoft Edge, etc.&lt;/p&gt;

&lt;p&gt;Now you can see that all logos of your respective browsers have their full opacity, but when you open the current HTML page on any of the given browsers, all logos will slightly fade out except one browser logo you’re currently using.&lt;/p&gt;

&lt;p&gt;To detect the browser, I have used a JavaScript navigator object. This navigator object contains information about the browser which is used to detect the following browsers. This JavaScript object is used for browser detection as well as to get different information related to the browser. Likewise, to detect the browser follow the given instruction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You might like this:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://codewithnepal.com/website-builder-in-2022/"&gt;Website Builder in 2022.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://codewithnepal.com/snake-javascript/"&gt; Snake JavaScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://codewithnepal.com/personal-portfolio-website/"&gt;Personal Portfolio Website&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://codewithnepal.com/word-guessing-game-in-html-css-javascript/"&gt;Word Guessing Game&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Detect Browser in JavaScript
&lt;/h2&gt;

&lt;p&gt;At first, I gave opacity 0.3 to all browser logos and in JavaScript, using navigator.UserAgent object I got the information about the browser and then using if/else if statements I matched the particular string (browser name) in the browser information that I got recently using the navigator.userAgent.&lt;/p&gt;

&lt;p&gt;If the given string is matched then I passed the browser name in the browser variable. Now I got which browser is being used by the user. After I got it, simply I selected this browser class name which is an IMG tag and gave opacity 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Initially you need to create two files HTML (.html) and CSS (.css) . After creating these files, just paste the following codes into your VS IDE code sample create an HTML file called index.html and paste the indicated codes into your HTML file (.html) Remember, you must create a file with the extension. HTML.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;!-- Coding By CodeWithNepal --&amp;gt;
&amp;lt;html lang="en" dir="ltr"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8"&amp;gt;
    &amp;lt;title&amp;gt;Detect Browser in JavaScript | CodeWithNepal&amp;lt;/title&amp;gt;
    &amp;lt;link rel="stylesheet" href="style.css"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div class="wrapper"&amp;gt;
      &amp;lt;h2&amp;gt;Browser:&amp;lt;/h2&amp;gt;
      &amp;lt;div class="logos"&amp;gt;
        &amp;lt;img class="chrome" src="logos/chrome.png" alt="chrome" title="Google Chrome"&amp;gt;
        &amp;lt;img class="firefox" src="logos/firefox.png" alt="firefox" title="Mozilla Firefox"&amp;gt;
        &amp;lt;img class="edge" src="logos/edge.png" alt="edge" title="Microsoft Edge"&amp;gt;
        &amp;lt;img class="opera" src="logos/opera.png" alt="opera" title="Opera"&amp;gt;
        &amp;lt;img class="safari" src="logos/safari.png" alt="safari" title="Apple Safari"&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;

    &amp;lt;script&amp;gt;
      let userAgent = navigator.userAgent;
      let browser;
      if(userAgent.match(/edg/i)){
        browser = "edge";
      }else if(userAgent.match(/firefox|fxios/i)){
        browser = "firefox";
      }else if(userAgent.match(/opr\//i)){
        browser = "opera";
      }else if(userAgent.match(/chrome|chromium|crios/i)){
        browser = "chrome";
      }else if(userAgent.match(/safari/i)){
        browser = "safari";
      }else{
        alert("Other browser");
      }
      const logo = document.querySelector(`.logos .${browser}`);
      if(logo){
        logo.style.opacity = "1";
      }
    &amp;lt;/script&amp;gt;

  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And, create a CSS file named style.css and paste the indicated codes into your CSS file. Remember, you must create a .css file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Import Google font - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&amp;amp;display=swap');
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}
body{
  height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(#252930 50%, #b75afe 50%);
}
::selection{
  color: #fff;
  background: #b75afe;
}
.wrapper{
  display: flex;
  flex-wrap: wrap;
  background: #fff;
  padding: 30px 40px;
  align-items: center;
  border-radius: 10px;
  justify-content: center;
  box-shadow: 0 0 20px 0 rgba(0,0,0,0.1);
}
.wrapper h2{
  color: #b75afe;
  font-size: 46px;
}
.wrapper .logos{
  margin-left: 15px;
}
.logos img{
  opacity: 0.3;
  margin: 0 7px;
  transition: opacity 0.4s ease;
}
.logos img:last-child{
  margin-right: 0px;
}

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

&lt;/div&gt;



&lt;p&gt;That’s all, now you’ve successfully built Detect Browser in JavaScript If your code doesn’t work or you’ve faced any problems, please free to comment down I will provide the source code files.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>detectbrowser</category>
    </item>
    <item>
      <title>Factorial Program in Java</title>
      <dc:creator>Om Bhusal</dc:creator>
      <pubDate>Mon, 04 Jul 2022 15:07:43 +0000</pubDate>
      <link>https://dev.to/ombhusal/factorial-program-in-java-330h</link>
      <guid>https://dev.to/ombhusal/factorial-program-in-java-330h</guid>
      <description>&lt;p&gt;Hey folks, today in this blog you’ll see &lt;a href="https://codewithnepal.com/factorial-program-in-java/"&gt;Factorial Program in Java&lt;/a&gt;. I have created blogs on making a Group Chat APP Using JAVA and in this fantastic blog, you will learn how to create a Factorial Program in Java. So, Factorial Program in Java: Factorial of n is the product of all positive descending integers. Factorial of n is denoted by n!.For example:&lt;br&gt;
&lt;code&gt;6! = 720&lt;br&gt;
7! = 5040&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QTHyvjOe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bn7mv9sot2wv91dh23me.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QTHyvjOe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bn7mv9sot2wv91dh23me.jpg" alt="Image description" width="880" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, 6! is pronounced as “6 factorial”, it is also called “6 bang” or “6 shrieks”.&lt;/p&gt;

&lt;p&gt;The factorial is normally used in Combinations and Permutations (mathematics).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The factorial of a positive number n is given by:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;factorial of n (n!) = 1 * 2 * 3 * 4 * ... * n&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;There are many ways to write the &lt;a href="https://codewithnepal.com/factorial-program-in-java/"&gt;factorial program in java &lt;/a&gt;language. Let’s see the 3 ways to write the factorial program in java.&lt;/p&gt;

&lt;p&gt;You might like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codewithnepal.com/javascript-projects-for-beginners/"&gt;JavaScript Projects For Beginners&lt;/a&gt;&lt;br&gt;
&lt;a href="https://codewithnepal.com/how-to-make-an-automatic-image-sider-in-html-css/"&gt;Automatic Image Slider&lt;/a&gt;&lt;br&gt;
&lt;a href="https://codewithnepal.com/how-to-make-a-sidebar-menu-using-html-and-css/"&gt;Sidebar Menu using HTML and CSS&lt;/a&gt;&lt;br&gt;
&lt;a href="https://codewithnepal.com/cool-glowing-effect-on-buttons-using-html-css/"&gt;Cool Glowing Effect on Buttons&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1: Find the Factorial of a number using BigInteger&lt;/strong&gt;&lt;br&gt;
`import java.math.BigInteger;&lt;/p&gt;

&lt;p&gt;public class Factorial {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public static void main(String[] args) {

    int num = 30;
    BigInteger factorial = BigInteger.ONE;
    for(int i = 1; i &amp;lt;= num; ++i)
    {
        // factorial = factorial * i;
        factorial = factorial.multiply(BigInteger.valueOf(i));
    }
    System.out.printf("Factorial of %d = %d", num, factorial);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;Here, instead of long, we use BigInteger variable factorial.&lt;/p&gt;

&lt;p&gt;Since * cannot be used with BigInteger, we instead use multiply() for the product. Also, num should be cast to BigInteger not long for multiplication.&lt;/p&gt;

</description>
      <category>factorialprograminjava</category>
      <category>java</category>
    </item>
    <item>
      <title>Personal Portfolio Website</title>
      <dc:creator>Om Bhusal</dc:creator>
      <pubDate>Thu, 30 Jun 2022 09:18:57 +0000</pubDate>
      <link>https://dev.to/ombhusal/personal-portfolio-website-3k6l</link>
      <guid>https://dev.to/ombhusal/personal-portfolio-website-3k6l</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9awJ0vVe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bcbjgqbfqws9ovq621lz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9awJ0vVe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bcbjgqbfqws9ovq621lz.jpg" alt="Image description" width="880" height="587"&gt;&lt;/a&gt;Hey friends, Today in this blog you’ll learn how to create a website which is a Fully Responsive &lt;a href="https://codewithnepal.com/personal-portfolio-website/"&gt;Personal Portfolio Website&lt;/a&gt; using HTML CSS &amp;amp; JavaScript. I already shared many blogs on web design stuff like [Navigation Bar, Cards, Image Slider, Owl Carousel, Buttons, and many more]. Similarly, I’d shown how to create a full &lt;a href="https://codewithnepal.com/how-to-create-a-business-website-using-html-and-css/?ref=morioh.com&amp;amp;utm_source=morioh.com"&gt;business website&lt;/a&gt; by using HTML &amp;amp; CSS and now it’s time to create a portfolio website.&lt;/p&gt;

&lt;p&gt;**Personal portfolio **sites are consistent and should be maintained throughout your work. It offers potential clients a convenient way to view your work while allowing you to expand your skills/experience and services.&lt;/p&gt;

&lt;p&gt;You might like this:&lt;/p&gt;

&lt;p&gt;1.&lt;a href="https://codewithnepal.com/javascript-projects-for-beginners/"&gt;JavaScript Projects For Beginners&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://codewithnepal.com/how-to-make-an-automatic-image-sider-in-html-css/"&gt;Automatic Image Slider&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://codewithnepal.com/how-to-make-an-automatic-image-sider-in-html-css/"&gt;Sidebar Menu using HTML and CSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://codewithnepal.com/cool-glowing-effect-on-buttons-using-html-css/"&gt;Cool Glowing Effect on Buttons&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;On this site [&lt;strong&gt;Personal Portfolio Website&lt;/strong&gt;], there are six sections on one page – Home, About, Services, Skills, Teams, and Contact, and each section is attractive and eye-catching to the user. On the home page of this site, on the top, there is a sticky nav bar with a logo on the left side and some navigation links are on the right side. On the left side of the home page, there are texts which are about the author’s name, profession, and a button labelled “Hire me” as you can see in the image.&lt;/p&gt;

&lt;p&gt;What is a personal portfolio website (P.P.W)?&lt;br&gt;
A personal portfolio website is a professional website that provides information about what you do, what services you may offer, and how to contact you or your company. Portfolio websites are an easy way to promote yourself, your brand, or your business.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---AvoseeX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jd9l3po506lsfxeli75g.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---AvoseeX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jd9l3po506lsfxeli75g.JPG" alt="Image description" width="880" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://codewithnepal.com/personal-portfolio-website/"&gt;For Full Tutorial follow this link.&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

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