<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JavaScript &#8211; Learn Beginner</title>
	<atom:link href="https://learnbeginner.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>https://learnbeginner.com</link>
	<description>Start Your Tech Journey With Us &#124; Smart Learning, Great Beginning</description>
	<lastBuildDate>Sun, 05 Feb 2023 21:25:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>

<image>
	<url>https://learnbeginner.com/wp-content/uploads/2021/02/favicon.png</url>
	<title>JavaScript &#8211; Learn Beginner</title>
	<link>https://learnbeginner.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>4 Essential React Tips for Writing Better Code &#8211; Enhance Your Skills Today!</title>
		<link>https://learnbeginner.com/4-essential-react-tips-for-writing-better-code-enhance-your-skills-today/</link>
					<comments>https://learnbeginner.com/4-essential-react-tips-for-writing-better-code-enhance-your-skills-today/#respond</comments>
		
		<dc:creator><![CDATA[Learn Beginner]]></dc:creator>
		<pubDate>Sun, 05 Feb 2023 20:42:15 +0000</pubDate>
				<category><![CDATA[Beginners Guide]]></category>
		<category><![CDATA[Dev Tips]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[React]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Programmer]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<guid isPermaLink="false">https://learnbeginner.com/?p=3113</guid>

					<description><![CDATA[Whether you're a beginner just starting out or an experienced developer looking to improve your code, this blog is here to help you. In this post, we will explore some of the most effective React tips to instantly improve your code and bring your projects to the next level. So, let's get started!]]></description>
										<content:encoded><![CDATA[
<p>Welcome to the world of React, where creating beautiful and efficient applications has never been easier! With the right set of tips and tricks, you can take your React skills to the next level and create stunning apps that are both user-friendly and optimized for performance.</p>



<p>As you dive deeper into the world of React, it&#8217;s important to continually strive for excellence in your code. To assist you in this endeavor, I&#8217;d like to share four tips that have been invaluable in helping me write better React code. Whether you&#8217;re a seasoned developer or just starting out, I believe you&#8217;ll find something of value in these tips. So, let&#8217;s dive in and take your React skills to the next level!</p>



<h2 class="wp-block-heading">1. Return functions from handlers</h2>



<p>For those of you who have a background in functional programming, you&#8217;ll likely recognize the concept of &#8220;currying&#8221;. Essentially, it involves setting some parameters for a function ahead of time. By implementing this technique in React, you can streamline your code and make it more efficient. So, let&#8217;s delve into the world of currying and see how it can improve your React code.</p>



<p>We have an explicit problem with the boilerplate code below. That technique will help us!</p>



<pre class="wp-block-code"><code lang="jsx" class="language-jsx">export default function App() {
  const [user, setUser] = useState({
    firstName: "",
    lastName: "",
    address: ""
  });

  // First handler
  const handleFirstNameChange = (e) => {
    setUser((prev) => ({
      ...prev,
      firstName: e.target.value
    }));
  };

  // Second handler!
  const handleLastNameChange = (e) => {
    setUser((prev) => ({
      ...prev,
      lastName: e.target.value
    }));
  };

  // Third handler!!!
  const handleAddressChange = (e) => {
    setUser((prev) => ({
      ...prev,
      address: e.target.value
    }));
  };

  // What if we need one more input? Should we create another handler for it?

  return (
    &lt;>
      &lt;input value={user.fisrtName} onChange={handleFirstNameChange} />
      &lt;input value={user.lastName} onChange={handleLastNameChange} />
      &lt;input value={user.address} onChange={handleAddressChange} />
    &lt;/>
  );
}</code></pre>



<p class="has-text-color has-large-font-size" style="color:#111111"><strong>Solution</strong></p>



<pre class="wp-block-code"><code lang="jsx" class="language-jsx">export default function App() {
  const [user, setUser] = useState({
    firstName: "",
    lastName: "",
    address: ""
  });

  const handleInputChange = (field) => {
    return (e) => {
      setUser((prev) => ({
        ...prev,
        [field]: e.target.value
      }));
    };
  };

  return (
    &lt;>
      &lt;input value={user.firstName} onChange={handleInputChange("fistName")} />
      &lt;input value={user.lastName} onChange={handleInputChange("lastName")} />
      &lt;input value={user.address} onChange={handleInputChange("address")} />

      {JSON.stringify(user)}
    &lt;/>
  );
}</code></pre>



<p></p>



<h2 class="wp-block-heading">2. Separate responsibilities</h2>



<p>Making a “God” component is a common mistake that developers make. It’s called “God” because it contains many lines of code that are hard to understand and maintain. I strongly recommend dividing components into sets of independent sub-modules.</p>



<p>A typical structure for this would be:</p>



<ul class="wp-block-list">
<li><strong>UI module,&nbsp;</strong>responsible for visual representation only.</li>



<li><strong>Model module</strong>, containing only business logic. An example of this is a custom hook.</li>



<li><strong>Lib module</strong>, containing all required utilities for the component.</li>
</ul>



<p>Here’s a small demo example to help illustrate this concept.</p>



<pre class="wp-block-code"><code lang="jsx" class="language-jsx">export function ListComponent() {
  // Our local state
  const [list, setList] = useState([]);

  // Handler to load data from the server
  const fetchList = async () => {
    try {
      const resp = await fetch("https://www.example.com/list");
      const data = await resp.json();

      setList(data);
    } catch {
      showAlert({ text: "Something went wrong!" });
    }
  };

  // We want to fetch only on mount
  useEffect(() => {
    fetchList();
  }, []);

  // Handler responsible for deleting items
  const handleDeleteItem = (id) => {
    return () => {
      try {
        fetch(`https://www.example.com/list/${id}`, {
          method: "DELETE"
        });
        setList((prev) => prev.filter((x) => x.id !== id));
      } catch {
        showAlert({ text: "Something went wrong!" });
      }
    };
  };

  // Here we just render our data items
  return (
    &lt;div className="list-component">
      {list.map(({ id, name }) => (
        &lt;div key={id} className="list-component__item>">
          {/* We want to trim long name with ellipsis */}
          {name.slice(0, 30) + (name.length > 30 ? "..." : "")}

          &lt;div onClick={handleDeleteItem(id)} className="list-component__icon">
            &lt;DeleteIcon />
          &lt;/div>
        &lt;/div>
      ))}
    &lt;/div>
  );
}</code></pre>



<p></p>



<p>We should start by writing our utils that will be used in the model and UI modules.</p>



<pre class="wp-block-code"><code lang="jsx" class="language-jsx">export async function getList(onSuccess) {
  try {
    const resp = await fetch("https://www.example.com/list");
    const data = await resp.json();

    onSuccess(data)
  } catch {
    showAlert({ text: "Something went wrong!" });
  }
}

export async function deleteListItem(id, onSuccess) {
  try {
    fetch(`https://www.example.com/list/${id}`, {
      method: "DELETE"
    });
    onSuccess()
  } catch {
    showAlert({ text: "Something went wrong!" });
  }
}

export function trimName(name) {
  return name.slice(0, 30) + (name.lenght > 30 ? '...' : '')
}</code></pre>



<p></p>



<p>Now we need to implement our business logic. It simply will be a custom hook returning things we need.</p>



<pre class="wp-block-code"><code lang="jsx" class="language-jsx">export function useList() {
  const [list, setList] = useState([]);

  const handleDeleteItem = useCallback((id) => {
    return () => {
      deleteListItem(id, () => {
        setList((prev) => prev.filter((x) => x.id !== id));
      })
    };
  }, []);

  useEffect(() => {
    getList(setList);
  }, []);

  return useMemo(
    () => ({
      list,
      handleDeleteItem
    }),
    [list, handleDeleteItem]
  );
}</code></pre>



<p></p>



<p>The final step is to write our UI module and then combine it all together.</p>



<pre class="wp-block-code"><code lang="jsx" class="language-jsx">export function ListComponentItem({ name, onDelete }) {
  return (
    &lt;div className="list-component__item>">
      {trimName(name)}

      &lt;div onClick={onDelete} className="list-component__icon">
        &lt;DeleteIcon />
      &lt;/div>
    &lt;/div>
  );
}

export function ListComponent() {
  const { list, handleDeleteItem } = useList();

  return (
    &lt;div className="list-component">
      {list.map(({ id, name }) => (
        &lt;ListComponentItem
          key={id}
          name={name}
          onDelete={handleDeleteItem(id)}
        />
      ))}
    &lt;/div>
  );
}</code></pre>



<p></p>



<h2 class="wp-block-heading">3. Use objects map instead of conditions</h2>



<p>When it comes to displaying elements based on specific variables, you can use this powerful tip to simplify your code and make it more intuitive. This approach helps make your components more declarative and easier to understand, while also making it easier to extend their functionality in the future. So, whether you&#8217;re working on a complex project or just starting out, implementing this strategy can have a significant impact on the overall quality of your React code.</p>



<p class="has-text-color has-large-font-size" style="color:#111111"><strong>Problem</strong></p>



<p><img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f49d.png" alt="💝" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Don&#8217;t forget to subscribe and stay up-to-date with the latest tips and tricks for Frontend development! With new information being shared regularly, you won&#8217;t want to miss out on the opportunity to continue improving your skills and producing high-quality React code.</p>



<pre class="wp-block-code"><code lang="jsx" class="language-jsx">function Roles({type}) {
  let Component = UsualAccount

  if (type === 'vip') {
    Component = VipAccount
  }

  if (type === 'admin') {
    Component = AdminAccount
  }

  if (type === 'superadmin') {
    Component = SuperAdminAccount
  }

  return (
    &lt;div className='roles'>
      &lt;Component />
      &lt;RolesStatistics />
    &lt;/div>
  )
}</code></pre>



<p></p>



<p class="has-text-color has-large-font-size" style="color:#111111"><strong>Solution</strong></p>



<pre class="wp-block-code"><code lang="jsx" class="language-jsx">const ROLES_MAP = {
  'vip': VipAccount,
  'usual': UsualAccount,
  'admin': AdminAccount,
  'superadmin': SuperAdminAccount,
}

function Roles({type}) {
  const Component = ROLES_MAP[type]

  return (
    &lt;div className='roles'>
      &lt;Component />
      &lt;RolesStatistics />
    &lt;/div>
  )
}</code></pre>



<p></p>



<h2 class="wp-block-heading">4. Put independent variables outside of React lifecycle</h2>



<p>One important concept to keep in mind is separating logic that doesn&#8217;t require the React component lifecycle methods from the component itself. This approach can greatly improve the clarity of your code by making dependencies more explicit. As a result, it becomes much easier to read and understand your components, leading to more efficient and effective development. So, make sure to keep this technique in mind as you continue to work with React and improve your code.</p>



<p class="has-text-color has-large-font-size" style="color:#111111"><strong>Problem</strong></p>



<pre class="wp-block-code"><code lang="jsx" class="language-jsx">function useItemsList() {
  const defaultItems = [10, 20, 30, 40, 50]
  const [items, setItems] = useState(defaultItems)

  const toggleArrayItem = (arr, val) => {
    return arr.includes(val) ? arr.filter(el => el !== val) : [...arr, val];
  }

  const handleToggleItem = (num) => {
    return () => {
      setItems(toggleArrayItem(items, num))
    }
  }

  return {
    items,
    handleToggleItem,
  }
}</code></pre>



<p></p>



<p class="has-text-color has-large-font-size" style="color:#111111"><strong>Solution</strong></p>



<pre class="wp-block-code"><code lang="jsx" class="language-jsx">const DEFAULT_ITEMS = [
  10, 20, 30, 40, 50
]

const toggleArrayItem = (arr, val) => {
  return arr.includes(val) ? arr.filter(el => el !== val) : [...arr, val];
}

function useItemsList() {
  const [items, setItems] = useState(DEFAULT_ITEMS)

  const handleToggleItem = (num) => {
    return () => {
      setItems(toggleArrayItem(items, num))
    }
  }

  return {
    items,
    handleToggleItem,
  }
}</code></pre>



<p></p>



<p>In conclusion, there are many ways to improve your React code and make it more efficient, effective, and user-friendly. Whether it&#8217;s through currying, separating logic from components, using variables to display elements or some other technique, it&#8217;s important to stay up-to-date with the latest tips and tricks in the world of Frontend development.</p>



<p>I hope, you found this article useful. If you have any questions or suggestions, please leave comments. Your feedback helps me to become better.</p>



<p class="has-text-align-left"><strong>Keep these tips in mind, and never stop striving for excellence in your code.</strong><br><strong>Don’t forget to subscribe<img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f49d.png" alt="💝" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong><br><strong>Happy coding</strong>!</p>


<script>(function() {
	window.mc4wp = window.mc4wp || {
		listeners: [],
		forms: {
			on: function(evt, cb) {
				window.mc4wp.listeners.push(
					{
						event   : evt,
						callback: cb
					}
				);
			}
		}
	}
})();
</script><!-- Mailchimp for WordPress v4.10.2 - https://wordpress.org/plugins/mailchimp-for-wp/ --><form id="mc4wp-form-1" class="mc4wp-form mc4wp-form-2830 mc4wp-form-theme mc4wp-form-theme-dark" method="post" data-id="2830" data-name="Main Newsletter" ><div class="mc4wp-form-fields"><p>
	<label> 
		<input type="email" name="EMAIL" placeholder="Your email address"  style="max-width: 100%;" required />
	</label>
	<input type="submit" value="Subscribe Now" style="width: 100%;" />
</p></div><label style="display: none !important;">Leave this field empty if you&#8217;re human: <input type="text" name="_mc4wp_honeypot" value="" tabindex="-1" autocomplete="off" /></label><input type="hidden" name="_mc4wp_timestamp" value="1742322087" /><input type="hidden" name="_mc4wp_form_id" value="2830" /><input type="hidden" name="_mc4wp_form_element_id" value="mc4wp-form-1" /><div class="mc4wp-response"></div></form><!-- / Mailchimp for WordPress Plugin -->]]></content:encoded>
					
					<wfw:commentRss>https://learnbeginner.com/4-essential-react-tips-for-writing-better-code-enhance-your-skills-today/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>HOW TO VALIDATE A DOMAIN NAME USING REGULAR EXPRESSION</title>
		<link>https://learnbeginner.com/how-to-validate-a-domain-name-using-regular-expression/</link>
					<comments>https://learnbeginner.com/how-to-validate-a-domain-name-using-regular-expression/#respond</comments>
		
		<dc:creator><![CDATA[Hiren Vaghasiya]]></dc:creator>
		<pubDate>Wed, 13 May 2020 16:46:10 +0000</pubDate>
				<category><![CDATA[Beginners Guide]]></category>
		<category><![CDATA[Dev Tips]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Regular Expression]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://learnbeginner.com/?p=2660</guid>

					<description><![CDATA[In this technical and hacking era each and every developer used the validation using regular expression.]]></description>
										<content:encoded><![CDATA[
<p>Given string&nbsp;<strong>str</strong>, the task is to check whether the given string is a valid domain name or not by using&nbsp;Regular Expression.</p>



<p>The valid domain name must satisfy the following conditions:</p>



<ol class="wp-block-list"><li>The domain name should be a-z or A-Z or 0-9 and hyphen (-).</li><li>The domain name should be between 1 and 63 characters long.</li><li>The domain name should not start or end with a hyphen(-) (e.g. -learnbeginner.com or learnbeginner.com-).</li><li>The last TLD (Top level domain) must be at least two characters and a maximum of 6 characters.</li><li>The domain name can be a subdomain (e.g. hindi.learnbeginner.com).</li></ol>



<p><strong>Examples:</strong></p>


<p><strong>Input</strong>: str = “hindi.learnbeginner.com”<br><strong>Output</strong>: true<br><strong>Explanation</strong>:<br>The given string satisfies all the above-mentioned conditions. Therefore it is a valid domain name.</p>
<p><strong>Input</strong>: str = “-learnbeginner.com”<br><strong>Output</strong>: false<br><strong>Explanation</strong>:<br>The given string starts with a hyphen (-). Therefore it is not a valid domain name.</p>
<p><strong>Input</strong>: str = “learnbeginner.o”<br><strong>Output</strong>: false<br><strong>Explanation</strong>:<br>The given string has the last TLD of 1 character, the last TLD must be between 2 and 6 characters long. Therefore it is not a valid domain name.</p>
<p><strong>Input</strong>: str = “.com”<br><strong>Output</strong>: false<br><strong>Explanation</strong>:<br>The given string doesn’t start with a-z or A-Z or 0-9. Therefore it is not a valid domain name.</p>


<p><strong>Approach:</strong>&nbsp;The idea is to use&nbsp;Regular Expression&nbsp;to solve this problem. The following steps can be followed to compute the answer:</p>



<ol class="wp-block-list"><li>Get the String.</li><li>Create a regular expression to check valid domain name as mentioned below:<br><br>regex = “^((?!-)[A-Za-z0-9-]{1, 63}(?&lt;!-)\.)+[A-Za-z]{2, 6}$”<br><br>Where:<br><strong>^</strong>&nbsp;represents the starting of the string.<br><strong>(</strong>&nbsp;represents the starting of the group.<br><strong>(?!-)</strong>&nbsp;represents the string should not start with a hyphen (-).<br><strong>[A-Za-z0-9-]{1, 63}</strong>&nbsp;represents the domain name should be a-z or A-Z or 0-9 and hyphen (-) between 1 and 63 characters long.<br><strong>(?&lt;!-)</strong>&nbsp;represents the string should not end with a hyphen (-).<br><strong>\\.</strong>&nbsp;represents the string followed by a dot.<br><strong>)+</strong>&nbsp;represents the ending of the group, this group must appear at least 1 time, but allowed multiple times for subdomain.<br><strong>[A-Za-z]{2, 6}</strong>&nbsp;represents the TLD must be A-Z or a-z between 2 and 6 characters long.<br><strong>$</strong>&nbsp;represents the ending of the string.<br></li><li>Match the given string with the regular expression. In Java, this can be done by using&nbsp;Pattern.matcher().</li><li>Return true if the string matches with the given regular expression, else return false.</li></ol>



<pre class="wp-block-code"><code lang="java" class="language-java line-numbers">// Java program to validate domain name. 
// using regular expression. 
  
import java.util.regex.*; 
class GFG { 
  
    // Function to validate domain name. 
    public static boolean isValidDomain(String str) 
    { 
        // Regex to check valid domain name. 
        String regex = "^((?!-)[A-Za-z0-9-]"
                       + "{1,63}(?&lt;!-)\\.)"
                       + "+[A-Za-z]{2,6}"; 
  
        // Compile the ReGex 
        Pattern p = Pattern.compile(regex); 
  
        // If the string is empty 
        // return false 
        if (str == null) { 
            return false; 
        } 
  
        // Pattern class contains matcher() 
        // method to find the matching 
        // between the given string and 
        // regular expression. 
        Matcher m = p.matcher(str); 
  
        // Return if the string 
        // matched the ReGex 
        return m.matches(); 
    } 
  
    // Driver Code 
    public static void main(String args[]) 
    { 
        // Test Case 1: 
        String str1 = "learnbeginner.com"; 
        System.out.println(isValidDomain(str1)); 
  
        // Test Case 2: 
        String str2 = "hindi.learnbeginner.com"; 
        System.out.println(isValidDomain(str2)); 
  
        // Test Case 3: 
        String str3 = "-learnbeginner.com"; 
        System.out.println(isValidDomain(str3)); 
  
        // Test Case 4: 
        String str4 = "learnbeginner.o"; 
        System.out.println(isValidDomain(str4)); 
  
        // Test Case 5: 
        String str5 = ".com"; 
        System.out.println(isValidDomain(str5)); 
    } 
}</code></pre>



<p><br><strong>Output:</strong></p>


<pre>true<br />true<br />false<br />false<br />false</pre>


<h4 class="wp-block-heading">Thank you for reading, and let’s connect!</h4>



<p>Thank you for reading my blog, feel free to subscribe to my email newsletter, and ask questions and give your valuable suggestions.</p>


<script>(function() {
	window.mc4wp = window.mc4wp || {
		listeners: [],
		forms: {
			on: function(evt, cb) {
				window.mc4wp.listeners.push(
					{
						event   : evt,
						callback: cb
					}
				);
			}
		}
	}
})();
</script><!-- Mailchimp for WordPress v4.10.2 - https://wordpress.org/plugins/mailchimp-for-wp/ --><form id="mc4wp-form-2" class="mc4wp-form mc4wp-form-2830 mc4wp-form-theme mc4wp-form-theme-dark" method="post" data-id="2830" data-name="Main Newsletter" ><div class="mc4wp-form-fields"><p>
	<label> 
		<input type="email" name="EMAIL" placeholder="Your email address"  style="max-width: 100%;" required />
	</label>
	<input type="submit" value="Subscribe Now" style="width: 100%;" />
</p></div><label style="display: none !important;">Leave this field empty if you&#8217;re human: <input type="text" name="_mc4wp_honeypot" value="" tabindex="-1" autocomplete="off" /></label><input type="hidden" name="_mc4wp_timestamp" value="1742322087" /><input type="hidden" name="_mc4wp_form_id" value="2830" /><input type="hidden" name="_mc4wp_form_element_id" value="mc4wp-form-2" /><div class="mc4wp-response"></div></form><!-- / Mailchimp for WordPress Plugin -->]]></content:encoded>
					
					<wfw:commentRss>https://learnbeginner.com/how-to-validate-a-domain-name-using-regular-expression/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>STORY ABOUT WHAT IS JS (JAVASCRIPT)?</title>
		<link>https://learnbeginner.com/story-about-what-is-js-javascript/</link>
					<comments>https://learnbeginner.com/story-about-what-is-js-javascript/#respond</comments>
		
		<dc:creator><![CDATA[Hiren Vaghasiya]]></dc:creator>
		<pubDate>Sun, 10 May 2020 17:23:11 +0000</pubDate>
				<category><![CDATA[Beginners Guide]]></category>
		<category><![CDATA[Dev Tips]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[ECMA Script]]></category>
		<category><![CDATA[JavaScript History]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://learnbeginner.com/?p=2654</guid>

					<description><![CDATA[Welcome to the new article about what actual JS (JavaScript) is?]]></description>
										<content:encoded><![CDATA[
<p>Hello Learner,</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="769" height="257" src="https://learnbeginner.com/wp-content/uploads/2020/05/0029-Short-story-about-what-is-js-learnbeginner.png" alt="" class="wp-image-2656" srcset="https://learnbeginner.com/wp-content/uploads/2020/05/0029-Short-story-about-what-is-js-learnbeginner.png 769w, https://learnbeginner.com/wp-content/uploads/2020/05/0029-Short-story-about-what-is-js-learnbeginner-300x100.png 300w, https://learnbeginner.com/wp-content/uploads/2020/05/0029-Short-story-about-what-is-js-learnbeginner-150x50.png 150w, https://learnbeginner.com/wp-content/uploads/2020/05/0029-Short-story-about-what-is-js-learnbeginner-370x124.png 370w, https://learnbeginner.com/wp-content/uploads/2020/05/0029-Short-story-about-what-is-js-learnbeginner-270x90.png 270w, https://learnbeginner.com/wp-content/uploads/2020/05/0029-Short-story-about-what-is-js-learnbeginner-570x190.png 570w, https://learnbeginner.com/wp-content/uploads/2020/05/0029-Short-story-about-what-is-js-learnbeginner-740x247.png 740w" sizes="(max-width: 769px) 100vw, 769px" /></figure>



<p>As we all know <strong>JS</strong>&nbsp;stands for&nbsp;<strong>JavaScript</strong>.</p>



<p>It is a lightweight, cross-platform, an interpreted scripting language. It is well-known for the development of web pages, many non-browser environments also use it.</p>



<p>JavaScript can be used for Client-side developments as well as Server-side developments. JavaScript contains a standard library of objects, like Array, Date, and Math, and a core set of language elements like operators, control structures, and statements.</p>



<h4 class="wp-block-heading"><strong>JS version release year chart:</strong></h4>



<figure class="wp-block-image size-large"><img decoding="async" width="641" height="191" src="https://learnbeginner.com/wp-content/uploads/2020/05/0030-javascript-realease-year-history-learnbeginner.png" alt="" class="wp-image-2657" srcset="https://learnbeginner.com/wp-content/uploads/2020/05/0030-javascript-realease-year-history-learnbeginner.png 641w, https://learnbeginner.com/wp-content/uploads/2020/05/0030-javascript-realease-year-history-learnbeginner-300x89.png 300w, https://learnbeginner.com/wp-content/uploads/2020/05/0030-javascript-realease-year-history-learnbeginner-150x45.png 150w, https://learnbeginner.com/wp-content/uploads/2020/05/0030-javascript-realease-year-history-learnbeginner-370x110.png 370w, https://learnbeginner.com/wp-content/uploads/2020/05/0030-javascript-realease-year-history-learnbeginner-270x80.png 270w, https://learnbeginner.com/wp-content/uploads/2020/05/0030-javascript-realease-year-history-learnbeginner-570x170.png 570w" sizes="(max-width: 641px) 100vw, 641px" /><figcaption>Source: GeeksforGeeks</figcaption></figure>



<h4 class="wp-block-heading"><strong>JS Structure:</strong></h4>



<pre class="wp-block-code"><code lang="javascript" class="language-javascript">&lt;script type="text/javascript">  
    // Your javaScript code 
&lt;/script></code></pre>



<h4 class="wp-block-heading"><strong>Characteristics of JS:</strong></h4>



<ul class="wp-block-list"><li><strong>Dynamically typed languages:</strong>&nbsp;This language can receive different data types over time.</li><li><strong>Case Sensitive Format:</strong>&nbsp;JavaScript is case sensitive so you have to aware of that.</li><li><strong>Light Weight:</strong>&nbsp;It is so lightweight, and all the browsers are supported by JS.</li><li><strong>Handling:</strong>&nbsp;Handling events is the main feature of JS, it can easily response on the website when the user tries to perform any operation.</li><li>Interpreter Centered:&nbsp;Java Script is built with interpreter centered that allows the user to get the output without the use of the compiler.</li></ul>



<h4 class="wp-block-heading"><strong>Advantages of JS:</strong></h4>



<ul class="wp-block-list"><li>JavaScript executed on the user’s browsers not on the webserver so it saves bandwidth and load on the webserver.</li><li>The JavaScript language is easy to learn it offers syntax that is close to the English language.</li><li>In javaScript, if you ever need any certain feature then you can write it by yourself and use an add-on like&nbsp;Greasemonkey&nbsp;to implement it on the web page.</li><li>It doe’s not require compilation process so no compiler is needed user’s browsers do the task.</li><li>JavaScript is easy to debug, and there are lots of frameworks available that you can use and become master on that.</li></ul>



<h4 class="wp-block-heading"><strong>Disadvantages of JS:</strong></h4>



<ul class="wp-block-list"><li>JavaScript codes are visible to the user so the user can place some code into the site that compromises the security of data over the website. That will be a security issue.</li><li>All browsers interpret JavaScript that is correct but they interpret differently to each other.</li><li>It only supports single inheritance, so in few cases may require the object-oriented language characteristic.</li><li>A single error in code can totally stop the website&#8217;s code rendering on the website.</li><li>JavaScript stores number as a 64-bit floating-point number but operators operate on 32-bit bitwise operands.</li></ul>



<h4 class="wp-block-heading">Thank you for reading, and let’s connect!</h4>



<p>Thank you for reading my blog, feel free to subscribe to my email newsletter, and ask questions and give your valuable suggestions.</p>


<script>(function() {
	window.mc4wp = window.mc4wp || {
		listeners: [],
		forms: {
			on: function(evt, cb) {
				window.mc4wp.listeners.push(
					{
						event   : evt,
						callback: cb
					}
				);
			}
		}
	}
})();
</script><!-- Mailchimp for WordPress v4.10.2 - https://wordpress.org/plugins/mailchimp-for-wp/ --><form id="mc4wp-form-3" class="mc4wp-form mc4wp-form-2830 mc4wp-form-theme mc4wp-form-theme-dark" method="post" data-id="2830" data-name="Main Newsletter" ><div class="mc4wp-form-fields"><p>
	<label> 
		<input type="email" name="EMAIL" placeholder="Your email address"  style="max-width: 100%;" required />
	</label>
	<input type="submit" value="Subscribe Now" style="width: 100%;" />
</p></div><label style="display: none !important;">Leave this field empty if you&#8217;re human: <input type="text" name="_mc4wp_honeypot" value="" tabindex="-1" autocomplete="off" /></label><input type="hidden" name="_mc4wp_timestamp" value="1742322087" /><input type="hidden" name="_mc4wp_form_id" value="2830" /><input type="hidden" name="_mc4wp_form_element_id" value="mc4wp-form-3" /><div class="mc4wp-response"></div></form><!-- / Mailchimp for WordPress Plugin -->]]></content:encoded>
					
					<wfw:commentRss>https://learnbeginner.com/story-about-what-is-js-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
