Comments in any programming are used to explain the code and to make it more readable of developers.
Sometimes it is also useful when we quickly want to comment-out a code block to stop its execution during testing or debugging our codes.
Single-line comment are use to comment on one full line or a part of a line.
We can use single-line comment to explain a code in the same line or use it in debugging by comment out a code to prevent its executions.
To write a single-line comment, we have to start the text after two forward slashes
Lets see some example.
const a = 'animel' //declaring a variable //this is a code to add two numbers let a = 1 let b = 1 let c= a+b
Multi-line comment do the same work as single-line. But With Multi-line you can comment out multiple lines in one go.
The comment blocks start with two symbol:
/* and ends with
Lets see this example.
This article is how to sort an array of string with non-ASCII characters. Using localeCompare() we can sort mixed array with non-ascii characters.