<?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: dipotanchangya</title>
    <description>The latest articles on DEV Community by dipotanchangya (@dipotanchangya).</description>
    <link>https://dev.to/dipotanchangya</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%2F470759%2F8f645e64-c055-4a68-94fe-5a8e88d17053.jpg</url>
      <title>DEV Community: dipotanchangya</title>
      <link>https://dev.to/dipotanchangya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dipotanchangya"/>
    <language>en</language>
    <item>
      <title>Which one is the better function for calculating age?</title>
      <dc:creator>dipotanchangya</dc:creator>
      <pubDate>Tue, 16 Nov 2021 04:21:36 +0000</pubDate>
      <link>https://dev.to/dipotanchangya/which-one-is-the-better-function-for-calculating-age-41i6</link>
      <guid>https://dev.to/dipotanchangya/which-one-is-the-better-function-for-calculating-age-41i6</guid>
      <description>&lt;p&gt;//#FUNCTION 1&lt;br&gt;
function calcAge (dob) {&lt;br&gt;
    const currentYear = new Date(Date.now()).getFullYear();&lt;br&gt;
    const birthYear = new Date(dob).getFullYear();&lt;br&gt;
    return currentYear - birthYear&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;//#FUNCTION 2&lt;br&gt;
function Person(name, dob) {&lt;br&gt;
  this.name = name;&lt;br&gt;
  // this.age = age;&lt;br&gt;
  this.birthday = new Date(dob);&lt;br&gt;
  this.calculateAge = function(){&lt;br&gt;
    const diff =  Date.now() - this.birthday.getTime();&lt;br&gt;
    const ageDate = new Date(diff);&lt;br&gt;
    return Math.abs(ageDate.getUTCFullYear() - 1970);&lt;br&gt;
  }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;I find it hard to understand function 2, it uses unix time.&lt;br&gt;
The other one is very reader friendly, at least for me.&lt;br&gt;
Your opinions are welcome.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>I am looking for a mentor.</title>
      <dc:creator>dipotanchangya</dc:creator>
      <pubDate>Tue, 14 Sep 2021 01:11:14 +0000</pubDate>
      <link>https://dev.to/dipotanchangya/i-am-looking-for-a-mentor-1n6n</link>
      <guid>https://dev.to/dipotanchangya/i-am-looking-for-a-mentor-1n6n</guid>
      <description>&lt;p&gt;I know the basics of JS and little bit of html and css. I am looking for apprenticeship.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
