Promises in JavaScript are certainly familiar to anyone. A Promise represents a "promise" that when a function is called, it will definitely return a value in the future. Whether it is resolved or rejected, we can predict the likelihood of one of the two occurring. And one thing is for sure, both cannot occur at the same time. If you study Promise more closely, you will see...
1 month ago
Variables are an essential component in most programming languages. When we talk about variables, we often think of a syntax that includes a keyword, variable name, data type, and its initial value. Variables - as the name suggests, their values can be changed through assignment. Changing the value of a variable allows programmers to reuse variable names, save memory, and...
11 months ago
Me & the desire to "play with words"
Have you tried writing? And then failed or not satisfied? At 2coffee.dev we have had a hard time with writing. Don't be discouraged, because now we have a way to help you. Click to become a member now!
Have you tried writing? And then failed or not satisfied? At 2coffee.dev we have had a hard time with writing. Don't be discouraged, because now we have a way to help you. Click to become a member now!
Writing is one of the important skills for many people. Research shows that an average person spends 45% of their communication time listening, 16% reading. However, between speaking and writing is very different. While listening is passive information reception, reading is active. Although listening accounts for most of the time, the effectiveness is not high. For example, students usually only remember 50% of the information they hear after 24 hours and decrease to 25% after two weeks. Meanwhile, writing skills are considered important in professional environments.
At 2coffee.dev, we have over 4 years of writing experience. During that time, we continuously innovate learning and writing methods. Showing that writing is a skill that can be honed every day. If you are a beginner or still struggling with how to write a blog post, or even write everything, then don't hesitate any longer. Become a member to learn about our writing skills.
It would be a glaring omission not to talk about Promise in JavaScript. In fact, there have been many articles written about Promise, which you can find through Google or occasionally come across in a programming-related community. But because Promise is an important concept and everyone has a different way of explaining it, I still decided to write this article. When I first learned JavaScript, Promise was the most confusing thing. I thought I understood it and knew how to use it, but in reality, there were still many long and painful stumbles...
1 year ago
My initial encounter with this style left me quite puzzled. What are toJSON, handleResult, and handleError here? Are they functions, and if so, where are their parameters? How can they run without ending with () to call the function? Or at the very least, where are their input parameters? Numerous questions popped up in my mind, but at that time, there was no one to explain it to me. What you encounter frequently becomes familiar, so I started emulating this style, implicitly thinking, "Oh, I'll just write it like this, and it will work." It wasn't until later...
1 year ago
A while ago, I wrote an article on Error Handling Techniques in Node.js, focusing on how to catch errors and handle them effortlessly. In this article, we'll temporarily set aside those techniques and dive deep into the topic of "throwing" errors and how to "catch" them effectively. I believe many of us, including myself, have thrown an error that looks like this...
1 year ago
JavaScript made its first appearance nearly 30 years ago as a new programming language of its time. It certainly needed some time to stabilize and gain widespread use. Until now, we can't deny the success of JavaScript, as it appears everywhere in the web world. Furthermore, it has expanded beyond web browsers to accomplish even more. A product of technology never stops evolving. Over the years, JavaScript has continuously evolved, introducing more useful features and addressing its inherent limitations. TC39 is a group established within the ECMA association with the goal of standardizing JavaScript while actively developing and expanding it.
1 year ago
If you're familiar with object-oriented programming languages, classes are the clearest syntax for defining a new object. JavaScript is also considered an object-oriented programming language, but if you're an early JavaScript developer from around a decade ago, it didn't have the class syntax. Instead, it supported inheritance through prototypes, which had a somewhat different syntax compared to OOP in most other languages and wasn't highly regarded for its powerful OOP features. In recent years, ES6 introduced the class keyword...
1 year ago
JavaScript is a language for asynchronous programming - that's something everyone knows. Asynchronous operations are most evident in asynchronous functions, which do not immediately return a result but instead return it at some point in time. If you come from a background of PHP, Go, or even Java... you may have not heard or be confused about what asynchronous programming is. You may also wonder why JavaScript is a language for asynchronous programming and whether it brings any benefits or limitations to the language...
1 year ago
Finding solutions to problems is a crucial skill for programmers. Usually, the more we work, the more experience we gain. At this point, when faced with similar problems, we can quickly find a solution. There are many ways to learn from experience, one of which is to search and read many articles and documentation online. Sometimes the knowledge we acquire may not be immediately necessary, but it can be useful at some point. Or at least...
1 year ago
I still remember when I first read an article about Higher-order functions, there was a certain level of confusion. Being new to the field, the theoretical aspect was quite difficult to grasp. At that time, I understood the concept but couldn't visualize its practical applications. It took me a while to realize that this was something I had been using regularly all along! There are already many articles about Higher-order functions on the internet...
1 year ago
Hello, I'm Hoai.
Click to get to know me!