Skip to content
the poor coder

self or this javascript

Poor Man
Published
Reading time
2 min read
On this page

Self or this JavaScript?#

When it comes to programming, one often faces the dilemma of choosing between writing code oneself or relying on an existing library or framework. This is especially true in case of JavaScript, which has a vast ecosystem of libraries and frameworks to choose from.

Self-Written JavaScript#

Writing your own JavaScript code can be a great learning experience. It allows you to understand the intricacies of the language, and how it works under the hood. Moreover, writing code from scratch gives you full control over what you want to achieve.

However, writing code from scratch can be time-consuming and error-prone. It requires a deep understanding of the language, and even then, you might end up reinventing the wheel. This is where existing libraries and frameworks come in handy.

JavaScript Libraries and Frameworks#

JavaScript libraries and frameworks are pre-written pieces of code that can be used to achieve common programming tasks. They provide a set of pre-built functions and classes that can be used to simplify your coding process. They can save you a lot of time and effort, and often have extensive documentation and support.

Some popular JavaScript frameworks include React, Angular, and Vue.js, while popular libraries include jQuery, Lodash, and Moment.js.

Choosing Between Self-Written JavaScript and Libraries/Frameworks#

Choosing between self-written JavaScript and libraries/frameworks depends on several factors:

  • Time Constraints: If you are working on a project with strict deadlines or limited resources, it may be more efficient to use an existing library or framework.
  • Project Requirements: If your project requires complex functionality that cannot be achieved with existing libraries/frameworks, it may be necessary to write your own code.
  • Learning Experience: If you are interested in learning JavaScript in-depth, writing code from scratch can be a great learning experience.

Conclusion#

Ultimately, the choice between self-written JavaScript and libraries/frameworks comes down to your individual needs and preferences. Both options have their strengths and weaknesses, and it is up to you to decide what works best for you.

JavaScript

// Here is an example of self-written JavaScript that adds two numbers:
function addNumbers(a, b) {
  return a + b;
}

// Here is an example of using the Lodash library to add two numbers:
const sum = _.add(2, 3);

As you can see, both options achieve the same result, but the second option uses an existing library to simplify the code.

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC