DRAFT
CharType
Misconception:
A single character written within single quotes (e.g., 'a'
) is of type char
.
Incorrect
A single character is of type char
Correct
A signle character is of type string
CorrectionHere is what's right.
Here is what's right.
In JavaScript, there is no type char
and there is no major difference between using single-quoted and double-quoted literals.
All these elements are of type string
, one of the six primitive data types.
OriginWhere could this misconception come from?
Where could this misconception come from?
Many programming languages (such as C/C++ and Java) have a special type to denote single characters.