<?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 Anik Sarker on Medium]]></title>
        <description><![CDATA[Stories by Anik Sarker on Medium]]></description>
        <link>https://medium.com/@anik-sarker?source=rss-4e442424c07f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Q_0lJ9HsKtFA-O21l1EMNg.jpeg</url>
            <title>Stories by Anik Sarker on Medium</title>
            <link>https://medium.com/@anik-sarker?source=rss-4e442424c07f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 13:33:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anik-sarker/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[Power of Factory Functions in JavaScript! ]]></title>
            <link>https://anik-sarker.medium.com/unlock-the-power-of-factory-functions-in-javascript-4e97fc9d54e1?source=rss-4e442424c07f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e97fc9d54e1</guid>
            <category><![CDATA[factory-functions]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[js-interview-questions]]></category>
            <dc:creator><![CDATA[Anik Sarker]]></dc:creator>
            <pubDate>Wed, 30 Oct 2024 17:07:05 GMT</pubDate>
            <atom:updated>2024-10-30T17:10:45.391Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o554B3kyl9qjiv8uaEWiig.jpeg" /><figcaption>Factory Function — JavaScript</figcaption></figure><p>As developers, we’re always on the lookout for patterns that make our code cleaner and more efficient. One such pattern is the <strong>factory function</strong>. If you’re not using them yet, here’s why you might want to start:</p><p>🔹 <strong>What is a Factory Function?</strong></p><p>A factory function is a function that returns a new object. Unlike constructors, they don’t require the new keyword, making them simpler and less error-prone.</p><p>🔹 <strong>Why Use Factory Functions?</strong></p><ul><li><strong>Encapsulation</strong>: Hide complex creation logic, making your codebase easier to maintain.</li><li><strong>Flexibility</strong>: Easily add conditions, defaults, or create different object types based on input.</li><li><strong>Avoid </strong><strong>new Keyword</strong>: Reduce errors by eliminating the need for new.</li></ul><p>🔹 <strong>Use Case: Configurable UI Components</strong></p><p>Imagine building a UI library where buttons need various configurations. A factory function can streamline this:</p><pre>function createButton({ label = &#39;Click Me&#39;, width = 100, height = 50, onClick = () =&gt; {} }) {<br>    return {<br>        label,<br>        width,<br>        height,<br>        onClick,<br>        render() {<br>            console.log(`Rendering a button: ${this.label} (${this.width}x${this.height})`);<br>        }<br>    };<br>}<br><br>const button1 = createButton({ label: &#39;Submit&#39;, width: 120 });<br>button1.render(); // Output: Rendering a button: Submit (120x50)</pre><ul><li>Creating multiple similar objects with shared methods.</li><li>Encapsulating and abstracting object creation logic.</li><li>Needing flexibility in object creation, like setting defaults.</li></ul><p>Factory functions are a powerful tool in JavaScript, helping you write cleaner, more maintainable code. Give them a try in your next project!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e97fc9d54e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Asynchronous Programming in Node.js: A Deep Dive into the Event Loop]]></title>
            <link>https://anik-sarker.medium.com/mastering-asynchronous-programming-in-node-js-a-deep-dive-into-the-event-loop-f2b4907b97ff?source=rss-4e442424c07f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2b4907b97ff</guid>
            <category><![CDATA[event-loop-in-js]]></category>
            <category><![CDATA[asynchronous-programming]]></category>
            <category><![CDATA[node-js-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[promises-in-javascript]]></category>
            <dc:creator><![CDATA[Anik Sarker]]></dc:creator>
            <pubDate>Thu, 24 Oct 2024 05:28:50 GMT</pubDate>
            <atom:updated>2024-10-24T05:29:42.711Z</atom:updated>
            <content:encoded><![CDATA[<p>Asynchronous programming is at the heart of Node.js, enabling it to handle multiple operations without blocking the execution of other tasks. This capability is crucial for building scalable and efficient applications, especially in today’s fast-paced digital environment. In this post, we’ll explore the intricacies of asynchronous programming in Node.js, focusing on the event loop, and share insights from my professional experience as a Full Stack Developer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*etjaK3UyTBu_N5eEj0ApEA.jpeg" /><figcaption>Asynchronous Programming in Node.js</figcaption></figure><h3>Understanding the Event Loop</h3><p>The event loop is a fundamental concept in Node.js, allowing it to perform non-blocking I/O operations. It works by offloading operations to the system kernel whenever possible. Here’s a simplified breakdown of how the event loop operates:</p><ol><li><strong>Event Queue</strong>: Node.js maintains an event queue where incoming requests are placed. The event loop continuously checks this queue for tasks to execute.</li><li><strong>Call Stack</strong>: When a task is ready to be executed, it’s moved to the call stack. If the stack is empty, the event loop processes the task.</li><li><strong>Non-blocking I/O</strong>: Node.js uses non-blocking I/O operations, meaning it doesn’t wait for a task to complete before moving on to the next one. This is achieved through callbacks, Promises, and async/await.</li></ol><h3>Asynchronous Patterns in Node.js</h3><h3>Callbacks</h3><p>Callbacks are the simplest form of asynchronous programming in Node.js. They are functions passed as arguments to other functions and are executed once the operation completes. However, excessive use of callbacks can lead to “callback hell,” making the code difficult to read and maintain.</p><h3>Promises</h3><p>Promises provide a more elegant way to handle asynchronous operations. They represent a value that may be available now, in the future, or never. Promises have three states: pending, fulfilled, and rejected. They allow chaining operations, making the code more readable.</p><h3>Async/Await</h3><p>Async/await is built on top of Promises and provides a more synchronous way to write asynchronous code. It allows you to write code that looks synchronous but is non-blocking. This pattern is particularly useful for complex operations that involve multiple asynchronous steps.</p><h3>My Experience with Asynchronous Programming</h3><p>In my role as a Full Stack Developer at Trienpont International, I have extensively used asynchronous programming to build scalable web applications. For instance, while working on the Bitkub project, I leveraged Next.js’s server-side rendering capabilities to optimize performance and user experience. This involved handling multiple asynchronous data-fetching operations efficiently.</p><p>Similarly, during my time at Ascend Commerce, I collaborated with cross-functional teams to enhance the True Online Store. We implemented optimizations to enhance page loading times, which required a deep understanding of asynchronous patterns to ensure smooth and responsive user interactions.</p><h3>Best Practices for Asynchronous Programming</h3><ol><li><strong>Error Handling</strong>: Always handle errors gracefully in asynchronous operations. Use try/catch blocks with async/await and .catch() with Promises.</li><li><strong>Avoid Callback Hell</strong>: Use Promises or async/await to avoid deeply nested callbacks.</li><li><strong>Optimize Performance</strong>: Use tools like Node.js’s built-in profiler to identify and optimize performance bottlenecks.</li><li><strong>Leverage Libraries</strong>: Utilize libraries like async to manage complex asynchronous workflows.</li></ol><h3>Conclusion</h3><p>Mastering asynchronous programming in Node.js is essential for building high-performance applications. By understanding the event loop and leveraging modern asynchronous patterns, you can create scalable solutions that meet the demands of today’s digital landscape.</p><h3>Connect with Me</h3><p>I’m Anik Sarker, a passionate Software Engineer with over four years of experience in full-stack development. If you’re interested in learning more about my work or collaborating on exciting projects, feel free to reach out:</p><ul><li><strong>Email</strong>: <a href="/service/mailto:aniksarker1612@gmail.com">aniksarker1612@gmail.com</a></li><li><strong>LinkedIn</strong>: <a href="https://linkedin.com/in/anik1612">linkedin.com/in/anik1612</a></li><li><strong>Portfolio</strong>: <a href="https://anik-sarker.vercel.app/">anik-sarker.vercel.app</a></li></ul><p>Let’s connect and explore the endless possibilities of technology together!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2b4907b97ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 30 Interview Questions for Full Stack Developer Positions (and How to Answer Them)]]></title>
            <link>https://anik-sarker.medium.com/top-30-interview-questions-for-full-stack-developer-positions-and-how-to-answer-them-57935e42fa52?source=rss-4e442424c07f------2</link>
            <guid isPermaLink="false">https://medium.com/p/57935e42fa52</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[interview-preparation]]></category>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[coding-interviews]]></category>
            <dc:creator><![CDATA[Anik Sarker]]></dc:creator>
            <pubDate>Thu, 24 Oct 2024 04:14:01 GMT</pubDate>
            <atom:updated>2024-10-24T04:14:01.003Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*36RqZRc854mt38MmIzXp7Q.jpeg" /><figcaption>Full stack developer top 30 interview question</figcaption></figure><p><em>Landing a full stack developer position requires a broad understanding of both front-end and back-end technologies. Interviewers will test your knowledge across various domains to assess your versatility and problem-solving skills. To help you prepare, we’ve compiled the top 30 interview questions you might encounter, along with insights on how to approach them.</em></p><h3>Table of Contents</h3><ol><li><a href="#general-questions">General Questions</a></li><li><a href="#front-end-questions">Front-End Questions</a></li><li><a href="#back-end-questions">Back-End Questions</a></li><li><a href="#database-questions">Database Questions</a></li><li><a href="#devops-and-tools-questions">DevOps and Tools Questions</a></li><li><a href="#behavioral-questions">Behavioral Questions</a></li><li><a href="#conclusion">Conclusion</a></li></ol><h3>General Questions</h3><h3>1. What is Full Stack Development?</h3><p><em>Answer:</em> Full stack development refers to the development of both front-end (client-side) and back-end (server-side) portions of web applications. Full stack developers are involved in building user interfaces, server logic, databases, and everything in between.</p><h3>2. Can you describe your experience with full stack development?</h3><p><em>Approach:</em> Share specific projects you’ve worked on, highlighting the technologies used and your role in each. This showcases your practical experience and expertise.</p><h3>3. What are the key responsibilities of a full stack developer?</h3><p><em>Answer:</em></p><ul><li>Designing user interactions on web pages.</li><li>Developing servers and databases for functionality.</li><li>Ensuring cross-platform optimization and responsiveness.</li><li>Working alongside graphic designers for web design features.</li><li>Seeing through a project from conception to finished product.</li></ul><h3>Front-End Questions</h3><h3>4. What is the difference between null and undefined in JavaScript?</h3><p><em>Answer:</em> null is an assigned value that represents no value, whereas undefined means a variable has been declared but not assigned a value.</p><h3>5. Explain the concept of Prototypal Inheritance in JavaScript.</h3><p><em>Answer:</em> Prototypal Inheritance is a feature in JavaScript where objects inherit properties and methods from other objects. It allows for the sharing of methods and properties between similar objects.</p><h3>6. What are the new features in HTML5?</h3><p><em>Answer:</em></p><ul><li>Semantic elements like &lt;header&gt;, &lt;footer&gt;, &lt;article&gt;, etc.</li><li>Multimedia support with &lt;audio&gt; and &lt;video&gt; tags.</li><li>New form controls like &lt;date&gt;, &lt;time&gt;, &lt;email&gt;, and &lt;url&gt;.</li><li>Canvas for drawing graphics on the fly.</li></ul><h3>7. How do CSS Flexbox and Grid differ?</h3><p><em>Answer:</em> Flexbox is one-dimensional (layout in rows or columns), suitable for aligning items in a single direction. Grid is two-dimensional, allowing for layouts in rows and columns simultaneously.</p><h3>8. What are Single Page Applications (SPAs)?</h3><p><em>Answer:</em> SPAs load a single HTML page and dynamically update content as the user interacts with the app, without reloading the entire page. This provides a smoother user experience.</p><h3>Back-End Questions</h3><h3>9. What is RESTful API, and why is it important?</h3><p><em>Answer:</em> RESTful APIs follow the REST architectural style, using standard HTTP methods. They are important because they provide a scalable and stateless way to interact with web services.</p><h3>10. Explain the difference between synchronous and asynchronous programming.</h3><p><em>Answer:</em> Synchronous programming executes tasks sequentially, blocking the execution until the current task completes. Asynchronous programming allows tasks to run concurrently, improving performance by not waiting for a task to finish before moving on.</p><h3>11. What are WebSockets, and how do they work?</h3><p><em>Answer:</em> WebSockets provide a persistent connection between a client and server, allowing for real-time communication with minimal overhead, ideal for live chats or gaming applications.</p><h3>12. How do you handle authentication and authorization in a web application?</h3><p><em>Answer:</em> Authentication verifies user identity (login), while authorization checks user permissions. Techniques include using JWT tokens, OAuth, session cookies, and implementing role-based access controls.</p><h3>13. What is Node.js, and why is it popular in back-end development?</h3><p><em>Answer:</em> Node.js is a JavaScript runtime built on Chrome’s V8 engine, enabling JavaScript to be used for server-side scripting. It’s popular due to its non-blocking, event-driven architecture, which makes it efficient for scalable network applications.</p><h3>Database Questions</h3><h3>14. What is the difference between SQL and NoSQL databases?</h3><p><em>Answer:</em></p><ul><li><strong>SQL Databases:</strong> Relational, use structured query language, and have predefined schemas (e.g., MySQL, PostgreSQL).</li><li><strong>NoSQL Databases:</strong> Non-relational, flexible schemas, and are document, key-value, graph, or wide-column stores (e.g., MongoDB, Cassandra).</li></ul><h3>15. Explain ACID properties in database systems.</h3><p><em>Answer:</em></p><ul><li><strong>Atomicity:</strong> Transactions are all-or-nothing.</li><li><strong>Consistency:</strong> Transactions move the database from one valid state to another.</li><li><strong>Isolation:</strong> Concurrent transactions occur independently.</li><li><strong>Durability:</strong> Once a transaction is committed, it remains so.</li></ul><h3>16. How do you optimize database queries?</h3><p><em>Answer:</em></p><ul><li>Use proper indexing.</li><li>Avoid SELECT * statements.</li><li>Use query profiling tools.</li><li>Normalize or denormalize tables as appropriate.</li><li>Limit the use of subqueries and use joins wisely.</li></ul><h3>17. What are ORM tools, and what advantages do they offer?</h3><p><em>Answer:</em> Object-Relational Mapping (ORM) tools connect object-oriented programming languages with relational databases. They simplify database interactions by allowing developers to work with database data as objects.</p><h3>DevOps and Tools Questions</h3><h3>18. What is the purpose of version control systems like Git?</h3><p><em>Answer:</em> Version control systems track changes to code over time, allowing multiple developers to collaborate efficiently, manage codebases, and maintain code history.</p><h3>19. Explain Continuous Integration and Continuous Deployment (CI/CD).</h3><p><em>Answer:</em> CI/CD automates the software delivery process. CI involves automatic building and testing of code changes, while CD automates the deployment of the code to production environments.</p><h3>20. How do you ensure code quality and testing in your projects?</h3><p><em>Answer:</em></p><ul><li>Write unit tests and integration tests.</li><li>Use code linters and formatters.</li><li>Conduct code reviews and pair programming.</li><li>Implement automated testing in CI/CD pipelines.</li></ul><h3>21. What are containers, and how do tools like Docker aid development?</h3><p><em>Answer:</em> Containers package an application and its dependencies into a virtual container that can run on any system. Docker simplifies the creation, deployment, and running of applications using containers.</p><h3>Behavioral Questions</h3><h3>22. Can you describe a challenging project and how you overcame obstacles?</h3><p><em>Approach:</em> Outline the project, challenges faced, steps taken to overcome them, and the successful outcome, emphasizing problem-solving and adaptability.</p><h3>23. How do you stay updated with the latest technologies and industry trends?</h3><p><em>Answer:</em> Mention blogs, podcasts, webinars, online courses, attending conferences, or contributing to open-source projects.</p><h3>24. Describe a situation where you had to work closely with a team to achieve a goal.</h3><p><em>Approach:</em> Highlight collaboration, communication skills, and how your teamwork led to achieving the project’s objectives.</p><h3>25. How do you handle tight deadlines and pressure?</h3><p><em>Answer:</em> Discuss time-management strategies, prioritizing tasks, staying organized, and being proactive in communicating with the team.</p><h3>Additional Technical Questions</h3><h3>26. What is Cross-Origin Resource Sharing (CORS), and why is it important?</h3><p><em>Answer:</em> CORS is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the resource originated. It’s essential for web security and API interactions.</p><h3>27. Explain the concept of MVC architecture.</h3><p><em>Answer:</em> Model-View-Controller (MVC) is a software architectural pattern that separates the application into three main components:</p><ul><li><strong>Model:</strong> Manages data and business logic.</li><li><strong>View:</strong> Handles data presentation and user interface.</li><li><strong>Controller:</strong> Processes user input and interacts with the model.</li></ul><h3>28. What are Web Services, and how do SOAP and REST differ?</h3><p><em>Answer:</em></p><ul><li><strong>Web Services:</strong> Methods of communication between two electronic devices over a network.</li><li><strong>SOAP:</strong> Protocol with strict standards, uses XML, and has built-in error handling.</li><li><strong>REST:</strong> Architectural style using standard HTTP methods, more flexible, and can use multiple formats (JSON, XML).</li></ul><h3>29. How does HTTPS work, and why is it important?</h3><p><em>Answer:</em> HTTPS encrypts data between the client and server using SSL/TLS protocols, ensuring secure communication and protecting data from eavesdroppers. It’s crucial for protecting sensitive information.</p><h3>30. What is Agile methodology, and have you worked in Agile environments?</h3><p><em>Answer:</em> Agile is an iterative approach to project management and software development that allows teams to deliver value to customers faster. Share any experiences working in Agile teams, such as using Scrum or Kanban frameworks.</p><h3>Conclusion</h3><p><em>Preparing for a full stack developer interview involves understanding a wide range of topics. By familiarizing yourself with these common questions and formulating thoughtful answers, you’ll be better equipped to showcase your skills and knowledge. Remember to also demonstrate your passion for technology and continuous learning, as the field is always evolving.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57935e42fa52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript — Tricky Beginner  Problems With Solutions]]></title>
            <link>https://anik-sarker.medium.com/javascript-tricky-beginner-problems-with-solutions-ea02d2a78fff?source=rss-4e442424c07f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea02d2a78fff</guid>
            <category><![CDATA[js-tricky-problem]]></category>
            <category><![CDATA[beginner-tricky-problem]]></category>
            <category><![CDATA[js-begineer-problem]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-problem]]></category>
            <dc:creator><![CDATA[Anik Sarker]]></dc:creator>
            <pubDate>Thu, 05 Nov 2020 13:07:39 GMT</pubDate>
            <atom:updated>2020-11-05T14:17:39.622Z</atom:updated>
            <content:encoded><![CDATA[<h3>JavaScript — Tricky Beginner Problems With Solutions</h3><p>I solved a few javascript beginner problems here. please read code comment carefully i explained by comment how the code works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*IUTKnjpGZ0BpeYHk.jpg" /></figure><h3>Find the largest element of an array:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uGcsmkgr3dmnyy2Um8mClQ.png" /></figure><p>Yay! now we can find the max number from an array.</p><h3><strong>Sum of all numbers in an array:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z443KENgXNupfNSROcmBCQ.png" /></figure><p>yay! we successfully solved another problem. Let&#39;s go, we have 8 more problems to do...</p><h3><strong>Remove duplicate item from an array:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7JLITEmGBfx2ULMjphM01g.png" /></figure><h4>Logic:</h4><p>index Of method check array item present in arrCpy or not if the item not present in arrCpy then indexOf method return -1 cause item not present and we chk if index == -1 then we push item to arrCpy.</p><h3>Count the number of words in a string:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GuMhJnvcLPTFrDoxgQglRA.png" /></figure><h3>Reverse a string:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*APmaNBSLTVdUp3bCWwO-vg.png" /></figure><h3>Calculate Factorial of a number using for loop:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xzwGJPx8uXiZ_1G7d5rUOA.png" /></figure><h3>Calculate Factorial of a number using a while loop:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*woFXuMqhTD-0q47ljbaTqQ.png" /></figure><h3><strong>Calculate Factorial in a Recursive function:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2SqWxHiahsJLm_mUM2aG_Q.png" /></figure><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LVFjk6MKFUFkGg1rQK_bcg.png" /></figure><h3>Create a Fibonacci Series using a for loop:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EdvtXUw6Wf16CmPakI9cXA.png" /></figure><h3><strong>Create a Fibonacci series in a recursive way:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wmWLmDegS96OiRdO3qBR-w.png" /></figure><h3>Check whether a number is a Prime Number or not:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fRLsnQot2q5KiDx2rXn-OQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea02d2a78fff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React — Short Brief]]></title>
            <link>https://anik-sarker.medium.com/react-short-brief-f97ec9dec396?source=rss-4e442424c07f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f97ec9dec396</guid>
            <category><![CDATA[what-is-react-js]]></category>
            <category><![CDATA[how-react-js-works]]></category>
            <category><![CDATA[react-js-short-intro]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[fundamental-react-js]]></category>
            <dc:creator><![CDATA[Anik Sarker]]></dc:creator>
            <pubDate>Wed, 04 Nov 2020 14:54:29 GMT</pubDate>
            <atom:updated>2024-10-24T04:46:44.736Z</atom:updated>
            <content:encoded><![CDATA[<h3>React — Short Discussion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/0*uSHKl1WBgYy_sVlL.jpeg" /></figure><p>React is a powerful JavaScript library for building dynamic user interfaces, particularly for single-page applications. This brief discusses React’s core concepts and its impact on modern web development.</p><h3>What is React.js?</h3><ul><li>Developed by Facebook</li><li>React is a view layer library, not a framework like Backbone, Angular, etc.</li><li>You can’t use React to build a fully-functional web app</li></ul><h3>Why was React developed?</h3><ul><li>The complexity of two-way data binding</li><li>Bad UX from using “cascading updates” of DOM tree</li><li>A lot of data on a page changing over time</li><li>The complexity of Facebook’s UI architecture</li><li>The shift from MVC mentality</li></ul><h3>Easy to understand what a component will render</h3><ul><li>Declarative code → predictable code</li><li>You don’t really need to study JS in the view file in order to understand what the file does</li></ul><h3>React is nothing but the view</h3><ul><li>No events</li><li>No XHR</li><li>No data/models</li><li>No promises / deferred</li><li>No idea how to add all of the above</li></ul><h3>Why should I use React?</h3><ul><li>Easy to read and understand views</li><li>Concept of components is the <em>future</em> of web development</li><li>If your page uses a lot of fast updating data or real-time data — React is the way to go</li><li>Once you and your team is over React’s learning curve, developing your app will become a lot faster</li></ul><h3>Is switching to React easy?</h3><p>Understanding how it works will take time and will slow you down at first (but once you and your team get it, things will start happening much faster)</p><h3>Fundamentals</h3><p>Most important terms in React</p><h3>Component</h3><p>Components are self-contained reusable building blocks of web application.</p><p>React components are basically just idempotent functions (same input produces same output).</p><p>They describe your UI at any point in time, just like a server-rendered app.</p><h3>Props</h3><ul><li>Passed down to component from parent component and represents data for the component</li><li>accessed via <strong>this.props</strong></li></ul><pre>render: function() {<br>    var someProp = &#39;bar&#39;;<br>    <br>    console.log(&#39;component render()&#39;, this.props);</pre><pre>    return &lt;div&gt;<br>        &lt;AnotherComponent foo={someProp} model={this.props.model} /&gt;<br>    &lt;/div&gt;;</pre><h3>State</h3><ul><li>Represents internal state of the component</li><li>Accessed via <strong>this.state</strong></li><li>When a component’s state data changes, the rendered markup will be updated by re-invoking render() method</li></ul><pre>render: function() {<br>    return &lt;h3&gt;Click count: <br>        &lt;span className=&#39;label label-default&#39;&gt;{this.state.clicks}&lt;/span&gt;<br>    &lt;/h3&gt;;<br>}</pre><h3>JSX</h3><ul><li>Arguably, one of the coolest things in React</li><li>XML-like syntax for generating component’s HTML</li><li>Easier to read and understand large DOM trees</li><li>Translates to plain JavaScript using <strong>react-tools</strong></li></ul><pre>/** @jsx React.DOM */</pre><pre>render: function () {<br>    return &lt;div&gt;<br>        &lt;h2&gt;<br>            &lt;strong&gt;Example 4:&lt;/strong&gt;  React App<br>        &lt;/h2&gt;<br>    &lt;/div&gt;;<br>}</pre><pre>/** regular DOM */</pre><pre>render: function () {<br>    return React.DOM.div(null, <br>        React.DOM.h2(null, React.DOM.strong(null, &quot;Example 4:&quot;), &quot; React App&quot;)<br>    );<br>}</pre><h3>Virtual DOM</h3><ul><li>The virtual DOM is used for efficient re-rendering of the DOM</li><li>React aims to re-render the virtual tree only when the state changes</li><li>Uses 2 virtual trees (new and previous) to find differences and batch update real DOM</li><li>Observes data changes (setState) and does dirty-checking to know when to re-render component</li><li>Whenever possible, does not update entire component in real DOM — only computes a patch operation that updates part of the DOM</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f97ec9dec396" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 important topics about JavaScript]]></title>
            <link>https://anik-sarker.medium.com/10-important-topics-about-javascript-33a497f0b30a?source=rss-4e442424c07f------2</link>
            <guid isPermaLink="false">https://medium.com/p/33a497f0b30a</guid>
            <category><![CDATA[event-loop-in-js]]></category>
            <category><![CDATA[coding-rules-in-js]]></category>
            <category><![CDATA[coding-rules-javascript]]></category>
            <category><![CDATA[import-topics-about-js]]></category>
            <category><![CDATA[naming-convention-in-js]]></category>
            <dc:creator><![CDATA[Anik Sarker]]></dc:creator>
            <pubDate>Tue, 03 Nov 2020 13:40:36 GMT</pubDate>
            <atom:updated>2024-10-24T04:56:00.594Z</atom:updated>
            <content:encoded><![CDATA[<h3>10 Essential Topics Every JavaScript Developer Should Master</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*tHn_8RF6htpl7ALA.jpeg" /><figcaption>10 Essential Topics Every JavaScript Developer Should Master</figcaption></figure><p>JavaScript is a cornerstone of modern web development, powering interactive and dynamic user experiences. To excel in this versatile language, developers must grasp several key concepts. This article outlines ten essential topics that every JavaScript developer should master, ensuring a solid foundation for building robust applications.</p><h3>1. Asynchronous JavaScript and the Event Loop</h3><p>Understanding asynchronous JavaScript is crucial for developing responsive applications. The event loop enables JavaScript to perform non-blocking operations, allowing it to handle multiple tasks simultaneously despite being single-threaded. Key concepts include:</p><ul><li><strong>Callbacks:</strong> Functions passed as arguments to other functions, executed after a task completes.</li><li><strong>Promises:</strong> Objects representing the eventual completion (or failure) of an asynchronous operation.</li><li><strong>Async/Await:</strong> Syntactic sugar for working with Promises, making asynchronous code easier to read and write.</li></ul><h3>2. Closures</h3><p>Closures are a fundamental concept in JavaScript, allowing functions to retain access to their outer scope even after the outer function has executed. This feature is essential for data encapsulation and creating private variables, enabling developers to build more modular and maintainable code.</p><h3>3. Prototypal Inheritance</h3><p>JavaScript employs prototypal inheritance, allowing objects to inherit properties and methods from other objects. This mechanism is achieved through the prototype chain, which promotes efficient memory usage and dynamic property access. Understanding prototypal inheritance is vital for leveraging JavaScript’s object-oriented capabilities.</p><h3>4. Hoisting</h3><p>Hoisting is JavaScript’s behavior of moving variable and function declarations to the top of their containing scope during compilation. This means that variables can be referenced before they are declared, which can lead to unexpected results. Familiarity with hoisting helps developers avoid common pitfalls and write cleaner code.</p><h3>5. Scopes and Scope Chain</h3><p>Scopes define the accessibility of variables in JavaScript. The language features function scope and block scope (introduced with let and const). The scope chain is utilized to resolve variable names in nested functions, making it essential for understanding variable visibility and lifetime.</p><h3>6. The this Keyword and Context</h3><p>The this keyword in JavaScript refers to the object that is currently executing the code. Understanding how this behaves in different contexts—such as global, function, method, and event handler contexts—is crucial for writing effective and bug-free code.</p><h3>7. Higher-Order Functions</h3><p>Higher-order functions are functions that either accept other functions as arguments or return functions as their result. This concept is a cornerstone of functional programming in JavaScript, enabling developers to create more abstract and reusable code. Common higher-order functions include map, filter, and reduce.</p><h3>8. JavaScript Design Patterns</h3><p>Familiarity with design patterns enhances code organization and reusability. Important design patterns in JavaScript include:</p><ul><li><strong>Module Pattern:</strong> Encapsulates private variables and functions.</li><li><strong>Singleton Pattern:</strong> Ensures a class has only one instance and provides a global point of access.</li><li><strong>Observer Pattern:</strong> Allows objects to subscribe and react to events or changes in other objects.</li><li><strong>Factory Pattern:</strong> Creates objects without specifying the exact class of object that will be created.</li></ul><h3>9. Error Handling</h3><p>Effective error handling is essential for building robust applications. Techniques include:</p><ul><li>Using try...catch blocks to manage exceptions.</li><li>Throwing custom errors to provide meaningful feedback.</li><li>Handling asynchronous errors with Promises and async/await to ensure smooth user experiences.</li></ul><h3>10. Modern JavaScript Features (ES6 and Beyond)</h3><p>Staying updated with the latest JavaScript features enhances productivity and code quality. Key additions from ES6 and beyond include:</p><ul><li><strong>Arrow Functions:</strong> Provide a concise syntax for writing functions.</li><li><strong>Template Literals:</strong> Allow for easier string interpolation and multi-line strings.</li><li><strong>Destructuring Assignment:</strong> Simplifies extracting values from arrays and objects.</li><li><strong>Spread and Rest Operators:</strong> Facilitate working with arrays and function arguments.</li><li><strong>Classes and Modules:</strong> Introduce a more structured approach to object-oriented programming.</li></ul><h3>Conclusion</h3><p>Mastering these ten essential topics is crucial for any JavaScript developer aiming to build efficient, maintainable, and scalable applications. By deepening your understanding of asynchronous programming, closures, prototypal inheritance, and modern JavaScript features, you will be well-equipped to tackle the challenges of web development. Embrace continuous learning and stay updated with industry trends to remain competitive in the ever-evolving landscape of JavaScript development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33a497f0b30a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Revisit JavaScript]]></title>
            <link>https://anik-sarker.medium.com/revisit-javascript-9fea747cf89?source=rss-4e442424c07f------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fea747cf89</guid>
            <category><![CDATA[revisit]]></category>
            <category><![CDATA[string]]></category>
            <category><![CDATA[revisit-javascript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[operators]]></category>
            <dc:creator><![CDATA[Anik Sarker]]></dc:creator>
            <pubDate>Mon, 02 Nov 2020 14:54:32 GMT</pubDate>
            <atom:updated>2020-11-02T15:38:01.190Z</atom:updated>
            <content:encoded><![CDATA[<h3>Short intro about Arrow Function and String Function in JavaScript</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bvF-9XZbw6csSSJIwFCoEQ.jpeg" /></figure><h3>Introduction:</h3><h4><strong>About JavaScript</strong></h4><p>JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic programming language that supports object-oriented and declarative style.</p><p>JavaScript can run on the browser as well as servers. Basically, any device containing a special program known as JavaScript engine (e.g V8 in Chrome) can execute JavaScript.</p><p><strong>What can Javascript do?</strong></p><p><strong>Modify HTML DOM and Styles<br>Handle Events <br>Handle Requests<br>Interact with third-party APIs<br>Work with Local Storage</strong></p><h3><strong>String Functions:</strong></h3><ol><li>toUpperCase() --&gt; returns the new string in uppercase format of source string</li></ol><pre>var str = &quot;anik&quot;;<br>var str2 = str.toUpperCase();<br>console.log(str);//anik<br>console.log(str2);//ANIK</pre><p>2.toLowerCase() --&gt; returns the new string in lowercase format of source string</p><pre>var str = &quot;ANIK&quot;;<br>var str2 = str.toLowerCase();<br>console.log(str);//ANIK<br>console.log(str2);//anik</pre><p>3.trim() --&gt; returns a new string with removed white space from start and end of the string.</p><pre>var str = &quot;   Jagathish  &quot;;<br>var trimmedStr = str.trim(); <br>console.log(trimmedStr); //&quot;Jagathish&quot;var str1 = &quot;J  aga&quot;;<br>var trimmedStr1 = str1.trim();<br>console.log(trimmedStr1); //&quot;J  aga&quot;var str2 = &quot;J   .&quot;;<br>var trimmedStr2 = str2.trim();<br>console.log(trimmedStr2); //&quot;J   .&quot;</pre><p>4.trimStart() --&gt; returns a new string with removed white space from start of the string. trimLeft() is an alias of this method.</p><pre>var str = &quot;   Anik  &quot;;<br>var trimmedStr = str.trimStart();<br>console.log(trimmedStr); //&quot;Anik  &quot;</pre><p>5.trimEnd() --&gt; returns a new string with removed white space at end of the string. trimRight() is an alias of this method.</p><pre>var str = &quot;   Anik  &quot;;<br>var trimmedStr = str.trimEnd(); <br>console.log(trimmedStr); //&quot;   Anik&quot;</pre><p>5.charAt() --&gt; returns the character at the given index.</p><pre>var str = &quot;Jagathish&quot;;<br>console.log( str.charAt() ); //the default index is 0 so &quot;J&quot;str.charAt(1); //astr.charAt(8); //hstr.charAt(100); //&quot;&quot; if max than str length returns empty stringstr.charAt(-1); // for all negative values returns empty string//no type conversion takes pace so the result is empty string<br>str.charAt(&quot;1&quot;);  //&quot;&quot;</pre><p>6.charCodeAt() --&gt; returns the UTF-16 character code of the character at the given index. All rules of index in chatAt method is similar to charCodeAt.</p><pre>// char code for <strong>a - 97, b =98 ,... z -122</strong>// char code for <strong>A - 65 ... Z - 90</strong>var str = &quot;Jagathish&quot;;str.charCodeAt(0); // 74str.charCodeAt(1); // 97</pre><p>7.concat(arguments) concate the arguments passed with the source string. It doesn’t change on source string.</p><pre>var str = &quot;JavaScript&quot;;<br>str.concat(&#39; &#39;, &quot;Jeep&quot;, &quot;.&quot;); // JavaScript Jeep.</pre><p><em>Note:</em> This method is not recommended , instead you can use normal concatenation using assignment operator.<br>Example</p><pre>var str = &quot;JavaScript&quot;.var name = str + &quot; &quot; + &quot;Jeep&quot; +&quot;.&quot;;</pre><p>8.includes(searchingString) returns whether searching String may be found in source string.</p><pre>var str = &quot;JavaScript Jeep&quot;;<br>str.includes(&quot;Jeep&quot;); // true<br>str.includes(&quot;jeep&quot;); // false --&gt; case sensitive// we can also specify the index to start searchvar str = &quot;Jeep&quot;;<br>str.includes(&quot;Jeep&quot;, 0);  // true<br>str.includes(&quot;Jeep&quot;, 1);  // false</pre><p>9.endsWith(searchString) returns whether the source string ends with the searching string.</p><pre>var str = &quot;JavaScript Jeep&quot;;<br>str.endsWith(&quot;Jeep&quot;); // truestr.endsWith(&quot;jeep&quot;); // falsestr.endsWith(&quot;Kepp&quot;); // false// we can also specify the endPosition(index+1) to which the test should runvar str = &quot;Jeep&quot;;str.endsWith(&quot;J&quot;);  //falsestr.endsWith(&quot;J&quot;, 1) // true</pre><p>10.startsWith(searchString) returns whether the source string starts with the searching string.</p><pre>var str = &quot;JavaScript Jeep&quot;;<br>str.startsWith(&quot;Java&quot;); // truestr.startsWith(&quot;java&quot;); // falsestr.startsWith(&quot;Ava&quot;); // false// we can also specify the <br>startPosition(index) to which the test should runvar str = &quot;JAVASCRIPT&quot;str.startsWith(&quot;VA&quot;);  //falsestr.startsWith(&quot;VA&quot;, 2) // truestr.startsWith(&quot;J&quot;, 1); // false --&gt; because we are saying to start search from index 1 .<br></pre><h3>Arrow functions:</h3><p>Let’s revisit arrow functions.</p><p>Arrow functions are not just a “shorthand” for writing small stuff. They have some very specific and useful features.</p><p>JavaScript is full of situations where we need to write a small function that’s executed somewhere else.</p><p>For instance:</p><ul><li>arr.forEach(func) – func is executed by forEach for every array item.</li><li>setTimeout(func) – func is executed by the built-in scheduler.</li></ul><p>It’s in the very spirit of JavaScript to create a function and pass it somewhere.</p><p>And in such functions, we usually don’t want to leave the current context. That’s where arrow functions come in handy.</p><h3>Arrow functions have no “this”</h3><p>As we remember from the chapter Object methods, “this”, arrow functions do not have this. If this is accessed, it is taken from the outside.</p><p>For instance, we can use it to iterate inside an object method:</p><pre>let group = {<br>  title: &quot;Our Group&quot;,<br>  students: [&quot;John&quot;, &quot;Pete&quot;, &quot;Alice&quot;],</pre><pre>  showList() {<br>    this.students.forEach(<br>      student =&gt; alert(this.title + &#39;: &#39; + student)<br>    );<br>  }<br>};</pre><pre>group.showList();</pre><p>Here in forEach, the arrow function is used, so this.title init is exactly the same as in the outer method showList. That is: group.title.</p><p>If we used a “regular” function, there would be an error:</p><pre>let group = {<br>  title: &quot;Our Group&quot;,<br>  students: [&quot;John&quot;, &quot;Pete&quot;, &quot;Alice&quot;],</pre><pre>  showList() {<br>    this.students.forEach(function(student) {<br>      // Error: Cannot read property &#39;title&#39; of undefined<br>      alert(this.title + &#39;: &#39; + student)<br>    });<br>  }<br>};</pre><pre>group.showList();</pre><p>The error occurs because forEach runs functions with this=undefined by default, so the attempt to access undefined.title is made.</p><p>That doesn’t affect arrow functions, because they just don’t have this.</p><p><strong>Arrow functions can’t run with </strong><strong>new</strong></p><p>Not having this naturally means another limitation: arrow functions can’t be used as constructors. They can’t be called with new.</p><p><strong>Arrow functions VS bind</strong></p><p>There’s a subtle difference between an arrow function =&gt; and a regular function called with .bind(this):</p><ul><li>.bind(this) creates a “bound version” of the function.</li><li>The arrow =&gt; doesn’t create any binding. The function simply doesn’t have this. The lookup of this is made exactly the same way as a regular variable search: in the outer lexical environment.</li></ul><h3>Arrows have no “arguments”</h3><p>Arrow functions also have no arguments variable.</p><p>That’s great for decorators when we need to forward a call with the current this and arguments.</p><p>For instance, defer(f, ms) gets a function and returns a wrapper around it that delays the call by ms milliseconds:</p><pre>function defer(f, ms) {<br>  return function() {<br>    setTimeout(() =&gt; f.apply(this, arguments), ms)<br>  };<br>}</pre><pre>function sayHi(who) {<br>  alert(&#39;Hello, &#39; + who);<br>}</pre><pre>let sayHiDeferred = defer(sayHi, 2000);<br>sayHiDeferred(&quot;John&quot;); // Hello, John after 2 seconds</pre><p>The same without an arrow function would look like:</p><pre>function defer(f, ms) {<br>  return function(...args) {<br>    let ctx = this;<br>    setTimeout(function() {<br>      return f.apply(ctx, args);<br>    }, ms);<br>  };<br>}</pre><p>Here we had to create additional variables args and ctx so that the function inside setTimeout could take them.</p><h3><a href="https://javascript.info/arrow-functions#summary">Summary</a></h3><p>Arrow functions:</p><ul><li>Do not have this</li><li>Do not have arguments</li><li>Can’t be called with new</li><li>They also don’t have super, but we didn’t study it yet. We will on the chapter Class inheritance.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fea747cf89" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>