<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Surjeet Bhadauriya on Medium]]></title>
        <description><![CDATA[Stories by Surjeet Bhadauriya on Medium]]></description>
        <link>https://medium.com/@sbsurjeet66?source=rss-b00753067625------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DW9QAI-zfMvedUFu3aLNeQ.jpeg</url>
            <title>Stories by Surjeet Bhadauriya on Medium</title>
            <link>https://medium.com/@sbsurjeet66?source=rss-b00753067625------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 18 May 2026 11:40:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sbsurjeet66/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[7 Useful Navigator Properties | JavaScript]]></title>
            <link>https://medium.com/sixberries-labs/6-useful-navigator-properties-javascript-d68e33f3e698?source=rss-b00753067625------2</link>
            <guid isPermaLink="false">https://medium.com/p/d68e33f3e698</guid>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[navigator]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Surjeet Bhadauriya]]></dc:creator>
            <pubDate>Tue, 13 Sep 2022 11:11:19 GMT</pubDate>
            <atom:updated>2022-09-14T21:47:15.800Z</atom:updated>
            <content:encoded><![CDATA[<p>What if I say to you, that you can auto-populate the user’s country in the drop-down based on his/her current location? And even tell users about their bad network speed, while they are using your website.</p><p>But why is it required? =&gt; <em>It adds a great user experience.</em></p><p>So let’s talk about what things can be done using <strong>Navigator.</strong></p><p><strong>Location (lat, lng)</strong></p><ul><li><strong>Navigator.geolocation.getCurrentPosition</strong> is used to get the user’s location detail</li><li>This is a <strong>callback</strong> function and it returns <strong>latitude, longitude, accuracy, etc</strong>…</li><li>Note: User needs to allow their location for this</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R_nEkNIuM-FntGMHc4-cdA.png" /><figcaption>navigator.geolocation</figcaption></figure><p><strong>Battery</strong></p><ul><li><strong>Navigator.getBattery</strong> returns the system’s battery details such as <br>- Battery level <br>- Charging status<br>- Charging time <br>- And many more</li><li>It returns a promise</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O0MgHghOuT9zEO_aJCDQYA.png" /><figcaption>navigator.getBattery</figcaption></figure><p><strong>Network Online or Offline</strong></p><ul><li><strong>Navigator.onLine</strong> returns the true or false based on your internet connection</li><li>If you have an active internet connection then it returns true else false</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kYc7_XHfKXnHT5VNBqQFyw.png" /><figcaption><a href="https://navigator.online/">navigator.onLine</a></figcaption></figure><p><strong>System Memory</strong></p><ul><li><strong>Navigator.deviceMemory</strong> is used to get system RAM information</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VMUpQh1tPCWCnLJoqPywig.png" /><figcaption>navigator.deviceMemory</figcaption></figure><p><strong>Network Connection</strong></p><ul><li><strong>Navigator.connection</strong> property returns the system’s connection information such as network type, bandwidth, etc...</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0kZ-rJsPntMTyQtTAZN8Zg.png" /><figcaption>navigator.connection</figcaption></figure><p><strong>Preferred Languages</strong></p><ul><li><strong>Navigator.languages</strong> is a read-only property and it returns an array of strings representing the user&#39;s preferred languages</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jp57pRgyHVd6qXHwYTLbkw.png" /><figcaption>navigator.languages</figcaption></figure><p><strong>Current Active Language</strong></p><ul><li><strong>Navigator.language</strong> is a read-only property returns a string representing the browser’s current active language</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v9yr4h0hAzrf7kwZ1VdXEg.png" /><figcaption>navigator.language</figcaption></figure><p>That’s it. Thanks for reading!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d68e33f3e698" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sixberries-labs/6-useful-navigator-properties-javascript-d68e33f3e698">7 Useful Navigator Properties | JavaScript</a> was originally published in <a href="https://medium.com/sixberries-labs">SixBerries Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[13 JavaScript Array Methods]]></title>
            <link>https://medium.com/@sbsurjeet66/13-javascript-array-methods-bf3df9cdeab0?source=rss-b00753067625------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf3df9cdeab0</guid>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-arrays]]></category>
            <category><![CDATA[javascript-array-methods]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <dc:creator><![CDATA[Surjeet Bhadauriya]]></dc:creator>
            <pubDate>Wed, 09 Feb 2022 12:16:16 GMT</pubDate>
            <atom:updated>2022-02-09T12:16:16.574Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s talk about Array methods.</p><p>We work with data every day. The world itself is data. When we work with data in programming, we widely use the array to store and process the data.</p><blockquote>But… Are we using the right method at right place to process the array of data?</blockquote><p>To be honest… I see a lot of developers still use the map and filter method to print the array element. A lot of them still don’t know the reduce, some, and every method. And some of them only use the forEach everywhere.</p><p>So here I have described the <strong>13 most used array methods</strong> in easy words.</p><h3>forEach</h3><ul><li>The forEach() method <strong>calls a callback function</strong> once for each array element</li><li>The callback function takes <strong>3 arguments: </strong><br>- value <br>- index <br>- array itself</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hTiRp1eAFvJruX6E1jpg6g.png" /><figcaption>forEach method javascript</figcaption></figure><h3>map</h3><ul><li>It is <strong>used to map</strong> the array data</li><li>It <strong>creates a new array</strong> and does not change the original array</li><li>The returned array has the <strong>same length</strong> as the input array</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ltype7dBpCIXCeCwxUc_bQ.png" /><figcaption>map method javascript</figcaption></figure><h3>filter</h3><ul><li>Used to <strong>filters the array</strong> based on the given condition</li><li>It also <strong>creates a new array</strong> and does not modify the original array.</li><li><strong>Return an empty array</strong> if array elements do not match with the given condition</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WthPE7O1fA7vJAFl0J-1vg.png" /><figcaption>filter method javascript</figcaption></figure><h3>find</h3><ul><li>Behaves the same as a filter, but it only <strong>returns a single element</strong></li><li>It also has the <strong>condition</strong></li><li>It stops at the first element that <strong>“passes the condition”</strong> and returns that</li><li>Returns <strong>undefined</strong> if the condition does not match with any element</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r2JnWpcHEximOhIdIR4sVQ.png" /><figcaption>find method javascript</figcaption></figure><h3>findIndex</h3><ul><li>Similar to find() but <strong>returns index</strong> instead of element</li><li><strong>Returns -1</strong> If does not passes the test</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WINaUajAP0if2fL2omfI-A.png" /><figcaption>findIndex method javascript</figcaption></figure><h3>reduce</h3><ul><li>The reduce() method runs a function on each array element to <strong>produce (reduce it to) a single value</strong></li><li>For each iteration, the return value of the callback passed on as an <strong>accumulator</strong> argument of the next iteration</li><li>Takes <strong>initial value</strong> as a second argument (Optional)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lPg9Osu-DeaRSsVc6FMvKA.png" /><figcaption>reduce method javascript</figcaption></figure><h3>reduceRight</h3><ul><li>Same as reduce, but reduceRight() works from <strong>right-to-left</strong> in the array</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wV-ilUEjtH3EYmFUNWaf-Q.png" /><figcaption>reduceRight method javascript</figcaption></figure><h3>every</h3><ul><li>Check if <strong>all array values</strong> pass a given condition</li><li>Returns true or false</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8h5o63kUWEcUXWHFufn2pg.png" /><figcaption>every method javascript</figcaption></figure><h3>some</h3><ul><li>Check if <strong>some array values</strong> pass a condition</li><li>It returns true or false</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9gzHLem_TU19nWgUcMZbbw.png" /><figcaption>some method javascript</figcaption></figure><h3>indexOf</h3><ul><li><strong>Returns the index</strong> of an array element if passes the condition</li><li>Returns <strong>-1</strong> otherwise</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qa9clwI1mQQpf5Nm0ljAJQ.png" /><figcaption>indexOf method javascript</figcaption></figure><h3>lastIndexOf</h3><ul><li>Same as indexOf(), but returns the index of the <strong>last occurrence</strong> of the specified element</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YlC7OtmMOagiT9S8Lv81_g.png" /><figcaption>lastIndexOf method javascript</figcaption></figure><h3>includes</h3><ul><li>Used to check if an <strong>element is present</strong> in an array</li><li><strong>Returns true or false</strong> based on the presence of element in the array</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Si4oQ0nLHZhMCYBYgtFjrA.png" /><figcaption>includes method javascript</figcaption></figure><h3>Array.from</h3><ul><li>Create an Array from a String</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b-KEESPcYicbKTf_-nBuVg.png" /><figcaption>Array.from method javascript</figcaption></figure><p>I hope you understand all array methods.</p><p>You can add the missing methods if you wish to in the comments below :)</p><p>Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf3df9cdeab0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[REST API with Deno OAK server (Deno + OAK)]]></title>
            <link>https://medium.com/sixberries-labs/rest-api-with-deno-oak-server-deno-oak-36ced1db54ca?source=rss-b00753067625------2</link>
            <guid isPermaLink="false">https://medium.com/p/36ced1db54ca</guid>
            <category><![CDATA[oak]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[deno]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Surjeet Bhadauriya]]></dc:creator>
            <pubDate>Mon, 22 Jun 2020 13:56:40 GMT</pubDate>
            <atom:updated>2020-10-05T23:03:55.294Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Deno. Bye Bye Node, Welcome Deno" src="https://cdn-images-1.medium.com/max/1024/1*I8lUiPv_IkJlVosvFRcaUg.jpeg" /></figure><blockquote><em>In this article, we will be creating a REST API using </em><a href="https://deno.land/"><em>Deno’s</em></a><em> framework </em><a href="https://github.com/oakserver/oak"><em>OAK</em></a><em>. If you are familiar with Node.js and Express/Koa then it will be easy for you to understand Deno + Oak.</em></blockquote><blockquote><em>I am presuming that you have basic/good knowledge of deno. As a result, I am only giving a short introduction. So, let’s first understand What is Deno and OAK.</em></blockquote><h3><strong>What is Deno?</strong></h3><ul><li>Deno is a JavaScript/TypeScript runtime that uses V8 engine.</li><li>It&#39;s built on V8, Rust, and Tokio.</li><li>Supports TypeScript out of the box.</li><li>Deno V1.0.0 was out officially on May 2020</li></ul><h3><strong>What is OAK?</strong></h3><ul><li>Oak is a Middleware Framework for Deno’s HTTP server; inspired by Koa Framework.</li><li>For those who are familiar with Node.js middleware frameworks like Express, Oak is similar to that in Deno</li></ul><p>So much theory man, where is the code 👨‍💻 ?!?! Let’s start with the setup</p><p><strong>Install Deno:</strong></p><p>Using Shell (macOS and Linux):</p><pre>$ curl -fsSL https://deno.land/x/install/install.sh | sh</pre><p>Using <a href="https://scoop.sh/">Scoop</a> (Windows):</p><pre>$scoop install deno</pre><p>Using <a href="https://chocolatey.org/packages/deno">Chocolatey</a> (Windows):</p><pre>$choco install deno</pre><p>Using <a href="https://formulae.brew.sh/formula/deno">Homebrew</a> (macOS):</p><pre>$brew install deno</pre><p>Using <a href="https://crates.io/crates/deno">Cargo</a> (Windows, macOS, Linux):</p><pre>$cargo install deno</pre><p>Below is the folder structure of our mini-project. server.js is our entry point file and all routes reside under routes folder.</p><figure><img alt="Deno project folder structure" src="https://cdn-images-1.medium.com/max/246/1*cQgpfD8cC80xnEB0OQZ9DA.png" /><figcaption>Project folder structure</figcaption></figure><p>Clone the example from <a href="https://github.com/suri66/deno-oak">Github</a></p><p><strong>server.js</strong></p><p>All third party modules are imported via URLs as Deno does not support npm. router.routes() method is used to configure routes. The application is listening on port3000.</p><pre>import { Application } from &#39;https://deno.land/x/oak/mod.ts&#39;;</pre><pre>import router from &#39;./routes/router.js&#39;;<br></pre><pre>const app = new Application();</pre><pre>app.use(router.routes());</pre><pre>app.use(router.allowedMethods());<br></pre><pre>console.log(&#39;Server is listening on 3000&#39;);</pre><pre>await app.listen({ port: 3000 });</pre><p><strong>routes/users/router.js</strong></p><p>Router is used to create routes.</p><pre>import { Router } from &#39;https://deno.land/x/oak/mod.ts&#39;;</pre><pre>import { getAllUser, getUserById } from &#39;./users/users.js&#39;;</pre><pre><br>const router = new Router();<br></pre><pre>router.get(&#39;/&#39;, (context) =&gt; {</pre><pre>context.response.body = &#39;Server is listerning on 3000&#39;;</pre><pre>});</pre><pre>router.get(&#39;/user&#39;, getAllUser);</pre><pre>router.get(&#39;/user/:id&#39;, getUserById);</pre><pre>export default router;</pre><p><strong>routes/users/users.js</strong></p><p>Below creates a dummy users array and performs an operation on it.</p><pre>const users = [<br>{ id: 1, name: &#39;Json Holder&#39; },<br>{ id: 1, name: &#39;Ram Singh&#39; }<br>];</pre><pre>export const getAllUser = (context) =&gt; {</pre><pre>try {</pre><pre>// just returning an object with data</pre><pre>context.response.body = {</pre><pre>message: &#39;Success&#39;,</pre><pre>data: users,</pre><pre>};</pre><pre>context.response.status = 200; // optional... but good to have</pre><pre>} catch (error) {</pre><pre>contxt.response.body = { message: &#39;Failed&#39;, error: e };</pre><pre>contxt.response.status = 500;</pre><pre>}<br>};</pre><pre><br>export const getUserById = async (context) =&gt; {</pre><pre>try {</pre><pre>let params = await context.params;</pre><pre>const user = users.find((u) =&gt; u.id === parseInt(params.id));</pre><pre>context.response.body = {</pre><pre>message: &#39;Success&#39;,</pre><pre> data: user,</pre><pre>};</pre><pre>context.response.status = 200;</pre><pre>} catch (e) {</pre><pre>contxt.response.body = { message: &#39;Failed&#39;, error: e };</pre><pre>contxt.response.status = 500;</pre><pre>}</pre><pre>};</pre><p>Thanks. Get in touch on <a href="https://in.linkedin.com/in/surjeet-bhadauriya-b26a1183">LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36ced1db54ca" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sixberries-labs/rest-api-with-deno-oak-server-deno-oak-36ced1db54ca">REST API with Deno OAK server (Deno + OAK)</a> was originally published in <a href="https://medium.com/sixberries-labs">SixBerries Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>