What I Have Learned About JavaScript Today

Mohammad Fahad
Nov 3, 2020 · 4 min read

1. Types of values in JavaScript

There are two types of values in javascript, one is called primitives and the other is objects and functions.
Let’s discuss Primitive values now.
Primitive values are :
●Undefined (undefined), used for unintentionally missing values.
● Null (null), used for intentionally missing values.
● Booleans (true and false) are used for logical operations.
● Numbers (-100, 3.14, and others), used for math calculations.
● Strings (“hello”, “abracadabra”, and others), used for text.
● Symbols (uncommon), used to hide implementation details.
● Bigints (uncommon and new), used for math on big numbers.
And Objects and functions are:
● Objects ({} and others), won't to group related data and code.
● Functions (x => x * 2 and others), used to refer to code.
Now the question is “where is the array?”
In the javascript universe, the rest are all objects.
NB: we will check values by using the tactic called typeof()

2. Using try… catch to handle errors :
Humans are not perfect, that goes for the codes as well no matter how good we are at writing codes an unexpected error might occur. One of the popular ways of handling these errors is the try… catch syntax.
try {
//some codes to execute
} catch(err){
// catch an error if there is any

3. Coding Style:
Every programmer can write codes that computers can understand, but only good programmers can write codes that humans can understand.
Have a glance at this diagram explaining some basics:
Image for post
NOTE: There is no you must kind of rule.

4. Best practice of comments:
As we all know that for a single line comment we use // and for multiple line comments we use /* comments */.
The best practice of using comments is to keep it simple and starting to the point. It will help others too.

5. Data Cost:
Every data from a client or server has a cost, it is defined by the data bit associated with its generation, transfer, and storage.

6. Client Catch:
When a client makes an API request the browser automatically saves some data like logs, images …etc to the local storage. So next time when the client sends a request first it looks for the data in the local storage, if found it executed if not then it goes outside. By this process, it saves the client’s valuable time and improves the system overall as well.

7. Server Caching:
When a request is made by many clients, the server can cache the data and sends a copy of it to all the users. It will relieve the server from making tons of requests at the same time.
To the API, this request looks like this:
The client makes a request to the API.
This request is received by the server.
The server checks for an area copy of the file requested. While this check features a cost, the value remains extremely low compared to the particular cost of computing a huge database check or generating content.
If the local resource exists, the server responds with its resource URI.
The client grabs the cached content.
If the local resource doesn’t exist, the request is processed normally.

8. Cross Platform Testing:
As a developer, we must run our app in multiple browsers to see whether it is running/supported in older or other browsers as well. This is a good practice to stay on the safe side.

9. SSL:
What is an SSL certificate? The answer is SSL certificates are small data files that cryptographically establish an encrypted link between an internet server and a browser. This link ensures that each one data passed between the online server and browser remains private.
SSL sites use HTTPS which stands for “Hypertext Transfer Protocol Secure” which is secured and the sites using HTTP stands for “Hypertext Transfer Protocol” which is not safe.

10. Emerging Best Practices for Block Bindings:
While ECMAScript 6 was in development, there was widespread belief you ought to use let by default rather than var for variable declarations. For many JavaScript developers, let behaves precisely the way they thought var should have behaved, then the direct replacement makes logical sense. In this case, you’d use const for variables that needed modification protection.
However, as more developers migrated to ECMAScript 6, an alternate approach gained popularity: use const by default and only use let once you know a variable’s value must change. The rationale is that the majority of variables shouldn’t change their value after initialization because unexpected value changes are a source of bugs. This idea features a significant amount of traction and is worth exploring in your code as you adopt ECMAScript 6.
That’s all for today. Hope it was useful.

Happy Coding :)

Sign up for Top 10 Stories

By The Startup

Get smarter at building your thing. Subscribe to receive The Startup's top 10 most read stories — delivered straight into your inbox, once a week. Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +787K followers.

Mohammad Fahad

Written by

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +787K followers.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store