<?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 Buddheesha Induwara on Medium]]></title>
        <description><![CDATA[Stories by Buddheesha Induwara on Medium]]></description>
        <link>https://medium.com/@buddhishainduwara?source=rss-55cf7bfd74fa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*PPfwXJVbzPJAhvrf</url>
            <title>Stories by Buddheesha Induwara on Medium</title>
            <link>https://medium.com/@buddhishainduwara?source=rss-55cf7bfd74fa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 10:18:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@buddhishainduwara/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[Introduction to React JS]]></title>
            <link>https://medium.com/@buddhishainduwara/introduction-to-react-js-db5db99c041c?source=rss-55cf7bfd74fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/db5db99c041c</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[frontend]]></category>
            <dc:creator><![CDATA[Buddheesha Induwara]]></dc:creator>
            <pubDate>Sun, 15 May 2022 18:05:49 GMT</pubDate>
            <atom:updated>2022-05-15T18:17:40.558Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B04BZgjbNfe9C41dG8bzSQ.png" /></figure><p>React.js is a free and open-source front-end JavaScript library for building user interfaces based on UI components. It is maintained by Meta (formerly Facebook) and a community of individual developers and companies. React can be used as a base in the development of single-page, mobile, or server-rendered applications with frameworks like Next.js. However, React is only concerned with state management and rendering that state to the DOM, so creating React applications usually requires the use of additional libraries for routing, as well as certain client-side functionality.</p><p><strong>How does React Work?</strong></p><p>React creates a VIRTUAL DOM in memory. Instead of manipulating the browser’s DOM directly, React creates a virtual DOM in memory, where it does all the necessary manipulating, before making the changes in the browser DOM.</p><p>React only changes what needs to be changed. React finds out what changes have been made, and changes only what needs to be changed.</p><h3><strong>Features of React</strong></h3><ul><li><strong>Components</strong></li><li><strong>Unidirectional data flow</strong>: Single source of truth — Data is originated and kept in one place, data is immutable. In React Data flow from the parent component to the child component and Action flow from child component to parent component.</li><li><strong>JSX: </strong>JSX stands for JavaScript XML. It is a JavaScript syntax extension. Its an XML or HTML like syntax used by ReactJS.</li><li><strong>Virtual DOM: </strong>A virtual DOM object is a representation of the original DOM object. It works like a one-way data binding. Whenever any modifications happen in the web application, the entire UI is re-rendered in virtual DOM representation. Then it checks the difference between the previous DOM representation and new DOM. Once it has done, the real DOM will update only the things that have actually changed. This makes the application faster, and there is no wastage of memory</li><li><strong>Props and State : </strong>Props are used to pass data and behaviors from container components to child components. Props are read only. Props are read only. State is used to keep data which can be updated. State is read write enabled. Use setState({}) method to update state.</li><li><strong>React Hooks: </strong>Hooks were added to React in version 16.8. Hooks allow function components to have access to state and other React features. Hooks allow us to “hook” into React features such as state and lifecycle methods</li><li><strong>Simplicity: </strong>ReactJS uses JSX file which makes the application simple and to code as well as understand. We know that ReactJS is a component-based approach which makes the code reusable as your need. This makes it simple to use and learn.</li><li><strong>Performance: </strong>ReactJS is known to be a great performer. This feature makes it much better than other frameworks out there today. The reason behind this is that it manages a virtual DOM</li></ul><h3><strong>Components in React</strong></h3><p>There are two ways to create components in React. They are class components and functional components.</p><ol><li><strong>Functional components</strong></li></ol><p>syntax:</p><pre>const Apple=()=&gt; {<br>  return &lt;h2&gt;Hi, I am an Apple!&lt;/h2&gt;;<br>}</pre><p><strong>Example: </strong>Let’s make a counter app that will increase the number of counts as users click on the “Add” button using Functional components.</p><pre>import React, { useState } from &quot;react&quot;;</pre><pre>const FunctionalComponent=()=&gt;{<br>   const [count, setCount] = useState(0);</pre><pre>   const increase = () =&gt; {<br>      setCount(count+1);<br>  }</pre><pre><strong>  </strong>return (</pre><pre>     &lt;div style={{margin:&#39;50px&#39;}}&gt;<br>         &lt;h1&gt;Welcome to React&lt;/h1&gt;<br>         &lt;h3&gt;Counter App using Functional Component : &lt;/h3&gt;<br>         &lt;h2&gt;{count}&lt;/h2&gt;<br>         &lt;button onClick={increase}&gt;Add&lt;/button&gt; <br>      &lt;/div&gt; <br>  )<br>}<br>export default FunctionalComponent;</pre><p><strong>2. Class Components</strong></p><p>Syntax:</p><pre>class Car extends React.Component {<br>  render() {<br>    return &lt;h2&gt;Hi, I am a Car!&lt;/h2&gt;;<br>  }<br>}</pre><p>The above example which we implemented using Functional components can also be implemented by class components.</p><p><strong>Example:</strong></p><pre>import React, { Component } from &quot;react&quot;;</pre><pre><br>class ClassComponent extends React.Component{</pre><pre>    constructor(){<br>       super();<br>       this.state={<br>            count :0<br>       };<br>       this.increase=this.increase.bind(this);<br>    }<br>    <br>    increase(){<br>       this.setState({count : this.state.count +1});<br>     }</pre><pre>    render(){ <br>       return (<br>         &lt;div style={{margin:&#39;50px&#39;}}&gt; <br>             &lt;h1&gt;Welcome to React &lt;/h1&gt; <br>             &lt;h3&gt;Counter App using Class Component : &lt;/h3&gt; <br>             &lt;h2&gt; {this.state.count}&lt;/h2&gt;<br>            &lt;button onClick={this.increase}&gt; Add&lt;/button&gt;<br>         &lt;/div&gt;<br>       )<br>    }</pre><pre>}</pre><pre>export default ClassComponent;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*F76E8lCTMxJeO16rj9DtgQ.png" /></figure><p>That’s all for this article on Introduction to React JS. Hope this article was helpful to you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db5db99c041c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[REST Services & Koa JS]]></title>
            <link>https://medium.com/@buddhishainduwara/rest-services-koa-js-b74207742482?source=rss-55cf7bfd74fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/b74207742482</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[rest]]></category>
            <category><![CDATA[koajs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Buddheesha Induwara]]></dc:creator>
            <pubDate>Sun, 15 May 2022 15:01:34 GMT</pubDate>
            <atom:updated>2022-05-15T15:07:14.965Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*0ObNJ2WuO599GlZaL4wBJQ.png" /></figure><h3><strong>RESTful Services</strong></h3><p>REST is an architectural style which was introduced by Roy Fielding in 2000 in his doctoral research. REpresentational State Tranfer (REST) is a stateless client-server architecture in which web services are viewed as resources and can be identified by their URIs. Here multiple URIs may refer the same resource. Web service clients that want to use resources access via globally defined set of remote methods that describe the action to be performed on the resource. REST services use JSON or XML to pass data. REST services are lightweight, scalable and maintainable.</p><p>Rest services consist of two components. They ate REST server and REST client. Here REST server provides access to the resources. REST client accesses the REST resource and modify it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*MSpApKSPkRxmCfT0dI_EKg.jpeg" /></figure><p>In REST architecture , clients and servers exchange representations of resources by using a standardized interface and protocol. The REST client can ask for specific representation via the HTTP protocol.</p><p><strong>HTTP Methods</strong></p><p>RESTful services use HTTP protocol methods for the operations they perform.</p><p>Those methods are,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*sm5N5PgnvSA6Od-KtxocJQ.png" /></figure><p><strong>Constraints of RESTful services</strong></p><ol><li><strong>Uniform Interface:</strong> Resources are manipulated using a fixed set of four create, read, update, delete operations: POST, GET, PUT, and DELETE.</li><li><strong>Stateless: </strong>each request from client to server must contain all the information necessary to understand the request, and cannot take advantage of any stored context on the server.</li><li><strong>Cacheable: </strong>to improve network efficiency, responses must be capable of being labeled as cacheable or non-cacheable.</li><li><strong>Client-Server:</strong> A clear separation concerns is the reason behind this constraint. Separating concerns between the Client and Server helps improve portability in the Client and Scalability of the server components</li><li><strong>Layered system: </strong>intermediaries, such as cache servers, proxy servers, gateways, etc. can be inserted between clients and resources to support security, performance, etc.</li></ol><h3>Koa JS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_SEhpSaIh7-l1jV-yFgeDQ.jpeg" /></figure><p>Koa is a new web framework for Node.js designed by the team behind Express, which aims to be a smaller, more expressive, and more robust foundation for web applications and APIs. By leveraging async functions, Koa allows you to ditch callbacks and greatly increase error-handling. Koa does not bundle any middleware within its core, and it provides an elegant suite of methods that make writing servers fast and enjoyable.</p><p><strong>Pros of Koa.js</strong></p><ol><li>Koa increases interoperability and robustness while still making middleware creation more fun.</li><li>Koa is extremely lightweight.</li><li>Cleaner, more readable async code.</li><li>No callback hell</li></ol><p><strong>Cons of Koa.js</strong></p><ol><li>Not compatible with Express-style middleware.</li><li>The open source community is relatively small.</li><li>Koa makes use of generators that are incompatible with all other Node.js framework middleware.</li></ol><p><strong>Hello world using Koa JS</strong></p><ol><li>create new folder and, cd into the folder with your terminal.</li><li>Do an npm init , and create a package.json file in the folder.</li><li>Install express by enteringnpm install koain terminal.</li><li>create an app.js file in the the folder and copy the following code,</li></ol><pre>const Koa = require(&#39;koa&#39;); // Require the koa package</pre><pre>const app = new Koa();</pre><pre>app.use((ctx) =&gt; {<br>    ctx.body = &#39;Hello World!&#39;; //display Hello world in the  body<br>})</pre><pre>// Listen to the server in port 5000<br>app.listen(5000, () =&gt; console.log(&#39;Server is listening on port 5000 &#39;))</pre><p>5. Enter node app.js in terminal to start the application.</p><p>6. Open a browser and go to the URL http://localhost:5000. It will display ‘Hello world!’ in the browser.</p><p>That’s all for this blog on REST services and Koa JS. Hope this blog was helpful to you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b74207742482" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Node Js and Express Js]]></title>
            <link>https://medium.com/@buddhishainduwara/introduction-to-node-js-and-express-js-bf0827d5fa84?source=rss-55cf7bfd74fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf0827d5fa84</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[expressjs]]></category>
            <dc:creator><![CDATA[Buddheesha Induwara]]></dc:creator>
            <pubDate>Sun, 15 May 2022 07:54:03 GMT</pubDate>
            <atom:updated>2022-05-15T07:54:03.394Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fk8n8DJu9-z_0bL8k-3UGQ.png" /></figure><h3><strong>Node JS</strong></h3><p>Node.js is an open-source and cross-platform JavaScript runtime environment for server-side and network application. It was developed by Ryan Dahl in 2009.</p><h4><strong>Why Node Js?</strong></h4><ul><li>Node.js uses asynchronous programming.</li><li>Node.js is extremely fast and great for building real-time web applications because of its asynchronous nature.</li><li>Node.js is event-driven and uses a non-blocking I/O model which makes Node.js lightweight and efficient.</li><li>Node.js eco-system NPM (Node Package Manager) is the largest in the world for open source libraries.</li></ul><p>Node.js is mainly made up of JavaScript and event loop. The event loop is basically a program that waits for events and dispatches them when they happens. Below diagram shows how Node.js works,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o8k35amUHESyjzqSEvNoJQ.png" /></figure><p><strong>Installing Node.js to your computer</strong></p><p>Install Node.js to your computer by downloading the LTS setup from below link.</p><p><a href="https://nodejs.org/en/">https://nodejs.org/en/</a></p><p>After installing, you can check whether it is properly installed by typing below command in the command prompt.</p><pre><strong>node -v</strong></pre><p>If you correctly installed Node.js to your local machine, above command should return Node.js version that is installed.</p><p><strong>Web Frameworks</strong></p><p>Common web-development tasks are not directly supported by Node,js itself. If you want to add specific handling for different HTTP verbs (e.g. GET, POST, DELETE, etc.), separately handle requests at different URL paths (&quot;routes&quot;), serve static files, or use templates to dynamically create the response, Node.js won’t be of much use on its own. For this you will either need to write the code yourself, or you can avoid reinventing the wheel and use a web framework.</p><h3><strong>Express Js</strong></h3><p>Express is a minimal and flexible Node.js web framework that provides a robust set of features for web and mobile applications.</p><p><strong>Why Express JS?</strong></p><ul><li>Easy to configure and customize.</li><li>Robust API makes routing easy</li><li>Express Js Includes various middleware modules which you can use to perform additional tasks on request and response.</li><li>Easy to integrate with different template engines like Jade, Vash, EJS etc.</li><li>Express Js Allows you to define an error handling middleware.</li><li>Express Js has a MVC like structure.</li></ul><p><strong>Hello world using Express JS</strong></p><ol><li>create new folder and, cd into the folder with your terminal.</li><li>Do an npm init , and create a package.json file in the folder.</li><li>Install express by enteringnpm install express in terminal.</li><li>create an app.js file in the the folder and copy the following code,</li></ol><pre>const express = require(&#39;express&#39;); // import express module<br>const app = express(); // create an Express application<br>const port = 5000;</pre><pre>/* <br>route definition, callback function that will be invoked whenever there is an HTTP GET request with a path relative to the site root callback function takes a request and a response object as arguments nd calls send() on the response to returns the string &quot;Hello World by Express!&quot;.<br>*/<br>app.get(&#39;/&#39;, (req, res) =&gt; {<br>  res.send(&#39;Hello World by Express!&#39;)<br>});</pre><pre>// starts up the server on a specified port(5000)<br>app.listen(port, () =&gt; { <br>   // log a comment to the console<br>   console.log(&#39;Example app listening on port 5000&#39;)<br>});</pre><p>5. Enter node app.js in terminal to start the application.</p><p>6. Open a browser and go to the URL http://localhost:5000. It will display ‘Hello world by Express!’ in the browser.</p><p>That’s all for this basic introduction on Node &amp; Express. Hope this blog was helpful to you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf0827d5fa84" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Git]]></title>
            <link>https://medium.com/@buddhishainduwara/introduction-to-git-2135b961e953?source=rss-55cf7bfd74fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/2135b961e953</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Buddheesha Induwara]]></dc:creator>
            <pubDate>Thu, 17 Mar 2022 14:02:55 GMT</pubDate>
            <atom:updated>2022-03-17T14:30:27.076Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*Vbbgb1GWEFgbuO4vbaqcxg.jpeg" /></figure><p>To explain what is Git, first we have to understand Version Control System.</p><p><strong>Version Control System (VCS)</strong></p><p>Version control system is a software tool that records changes done to source code over time so that you can recall specific version later. It allows us to revert files or even the entire project back to previous state. VCS helps to review changes done to source code and to find who made those changes.</p><p><strong>So what is Git?</strong></p><p>Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. As it is a distributed VCS, it does need to rely on central server to store all versions of project files. Instead, every user have a copy of repository and has the full version history of the project on their local machine.</p><p><strong>Setting up Git on your computer</strong></p><p>Install Git to your computer by downloading the setup from below link.</p><p><a href="https://git-scm.com/downloads">Install</a></p><p>After installing, you can check whether it is properly installed by typing below command in the command prompt.</p><pre><strong>git --version</strong></pre><p>If you correctly installed Git to your local machine, above command should return Git version that is installed.</p><p><strong>Local and Remote Repository</strong></p><p>A repository(repo) is a directory that has the all the version information related to project. Local repository is the repository stored on your computer. The remote repository is the repository that is stored on self-hosted server or a third party hosting service like GitHub.</p><p><strong>Basic Operations in Git</strong></p><ol><li><strong>Initializing the project</strong></li></ol><p>To start version controlling in our project we have to initialize it with Git. For that we have to open the command prompt and change directory to the project folder using “<strong>cd</strong>” command. Then you have to type following command which will initiates a empty local git repository.</p><pre><strong>git init</strong></pre><p>After executing this command it will create a hidden folder name “.git” in your project folder that will store all the information related to version controlling.</p><p><strong>2. Staging files</strong></p><p>After creating a repository we have to add files that we need to keep track of. For that we can use following command which will add all the files in the folder to git.</p><pre><strong>git add .</strong></pre><p>But if you need to add a specific file, you can use “git add file_name” command.</p><pre><strong>git add fileName.js</strong></pre><p>to add multiple files, we can do this</p><pre><strong>git add fileName1.js fileName2.js fileName3.js</strong></pre><p>to know whether that files are tracked or untracked we can use following command,</p><pre><strong> git status</strong></pre><p><strong>3. Making commits</strong></p><p>A commit is a snapshot of our project’s currently staged changes. To commit the files we use following command,</p><pre><strong>git commit -m &quot;Commit message&quot;</strong></pre><p>inside the quotes we have to write a small message which describe about the changes you did.</p><p>We can use following command to see all the commits made in the project,</p><pre><strong>git log</strong></pre><p><strong>4. Creating branches</strong></p><p>A branch is a version of the repository that diverges from the main working project.</p><p>To create a branch you can use the following command,</p><pre><strong>git branch &lt;new-branch-name&gt;</strong></pre><p>to switch to different branch you can use below command,</p><pre><strong>git checkout &lt;branch-name&gt;</strong></pre><p><strong>5. Pushing</strong></p><p>To push our code to remote repository, first we have to connect our local repository to the remote repository. To do that we can use the following command,</p><pre><strong>git remote add origin remote_repository_url</strong></pre><p>after executing the above command we can push our code using following command.</p><pre><strong>git push -u origin master</strong></pre><p>In the above command ‘origin’ is the name of remote repository and master is default git branch.</p><p><strong>6.pulling &amp; fetching</strong></p><p>If you are working with a team and one of the members do some changes to the code and push it to remote repository. If you need those changes to your local repository you can use the following command,</p><pre><strong>git fetch &lt;remote&gt;</strong></pre><p>above command will fetch those changes but will not add those files to local repository until you merge those changes by using following command,</p><pre><strong>git merge &lt;remote&gt;</strong></pre><p>But following command can be use to fetch and merge changes at once,</p><pre><strong>git pull &lt;remote&gt;</strong></pre><p>That’s all for this basic introduction on Git. Hope this blog was helpful to you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2135b961e953" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Objects in JavaScript]]></title>
            <link>https://medium.com/@buddhishainduwara/objects-in-javascript-5efee0b2e4d7?source=rss-55cf7bfd74fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/5efee0b2e4d7</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Buddheesha Induwara]]></dc:creator>
            <pubDate>Sat, 26 Feb 2022 12:50:59 GMT</pubDate>
            <atom:updated>2022-02-26T12:50:59.741Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*7py8vZKbbwF8el-LX2RgnQ.jpeg" /></figure><p>A JavaScript object is a collection of related data and/or functionalities. These are consist of several variables and functions which are called properties and methods when they are inside objects.</p><p>We can create a JavaScript objects in 3 ways. They are as follows,</p><ol><li><strong>By using object literal</strong></li></ol><p>example of creating object by object literal is given below,</p><pre>const student1= {<br>  name: &#39;Nimal&#39;,<br>  age: 23,<br>  getAge: function() {<br>             console.log(this.age);<br>          }<br>};</pre><p>In above code example, ‘this’ is a keyword used in JavaScript. It refers the current object the code is being written inside.</p><p><strong>2. By using a constructor function with the new key word</strong></p><p>example of creating object by using a constructor function with the new key word is given below,</p><pre>function Student(name, age) {<br>  this.name = name;<br>  this.age = age;<br>  this.getAge= function() {<br>    console.log(this.age);<br>  }<br>}</pre><pre>const student1 = new Student(Nimal, 23);</pre><p><strong>3. By using Object constructor.</strong></p><p>example of creating object by using Object constructor is given below,</p><pre>student1 = new Object();</pre><h4><strong>Accessing Keys in Object</strong></h4><p>There are two ways to access keys in JavaScript objects, they are,</p><ol><li><strong>Dot notation</strong></li></ol><p>Example code is given below,</p><pre>console.log(student1.name)       // output- Nimal<br>console.log(student1.getAge())   // output- 23</pre><p><strong>2. Square Bracket notation</strong></p><p>This notation used when keys contain special characters like space where dot notation doesn’t work .</p><p>Example code is given below,</p><pre>student2 = {<br>    &#39;my name&#39;: Nimal,<br>     age: 34<br>}</pre><pre>console.log(student2[&quot;my name&quot;])    // output- Nimal</pre><h4><strong>Object static methods</strong></h4><p>In JavaScript, there is an inbuilt advance object named ‘Object’ that has several methods defined. Those methods can be used to manipulate objects that are created by us.</p><p>Let’s see some of them ,</p><ol><li><strong>Object.create()</strong></li></ol><p>— this method will generate a new object by using a specified prototype object</p><p>Syntax:</p><pre>Object.create(prototypeObject)</pre><p>example code for this method is given below,</p><pre>student2 = Object.create(student1)</pre><p><strong>2. Object.defineProperty()</strong></p><p>— this method defines new or modifies existing property directly on an object.</p><p>Syntax:</p><pre>Object.defineProperty(object, property)</pre><p>example code for this method is given below,</p><pre>const person1 = {};</pre><pre>Object.defineProperty(person1 , &#39;name&#39;, {<br>  value: &#39;Amal&#39;,<br>  writable: true<br>});</pre><p><strong>3. Object.entries()</strong></p><p>— this methods returns an array with arrays of the key, value pairs.</p><p>Syntax:</p><pre>Object.entries(object)</pre><p>example code for this method is given below,</p><pre>const person2 = { name: &#39;Kamal&#39;, age: 34 country: &#39;Sri Lanka&#39;};</pre><pre>console.log(Object.entries(obj)[1])</pre><pre>// output -  [&quot;age&quot;, &quot;34&quot;]</pre><p><strong>4. Object.assign()</strong></p><p>— method copies all enumerable and own properties from a source object to a target<em> </em>object. It returns the modified target object.</p><p>Syntax:</p><pre>Object.assign(target, source)</pre><p>example code for this method is given below,</p><pre>const targetObject = { p: 2, q: 3};<br>const sourceObject = { q: 6, r: 9};</pre><pre>const returnedObject = Object.assign(targetObject, sourceObject);</pre><pre>console.log(targetObject);<br>//output - { p: 2, q:6 , r: 9 }</pre><pre>console.log(returnedObject);<br>// output- { p: 2, q:6 , r: 9 }</pre><p><strong>5. Object.keys()</strong></p><p>— This method returns an array of a given object’s own property names.</p><p>Syntax:</p><pre>Object.keys(object)</pre><p>example code for this method is given below,</p><pre>const person = {<br>  name: &#39;Timal&#39;,<br>  age: 43,<br>  country: &#39;Sri Lanka&#39;<br>};</pre><pre>console.log(Object.keys(person));<br>// output-  [&quot;name&quot;, &quot;age&quot;, &quot;country&quot;]</pre><p>Objects are one of the most important fundamental in javaScript. Almost every complex data types, including functions, are created from the javaScript objects . Understanding the basics of object creation and usage should definitely help in the long run of programming.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5efee0b2e4d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>