- When adding a number (int) and a string, a problem occurs.
- For example, it does not add 20 and '40' as numbers.
- Instead, it outputs '2040' a string concatenation.
- To perform actual addition, convert the string to a number using parseInt().
- See practical implementation in the 'parseInt.js' file.
- if the string does not consist of numeric characters, parseInt() will return NaN.
- Adding a number and a non-numeric string result: string concatenation. Example: 20 + 'amla' = '20amla' .
- Concate is happend only for addition operation (between integer and string or float or string).
- For subtraction, multiplication, division, modulus(%) operation string (consist of numbers) also count as number.
-
Notifications
You must be signed in to change notification settings - Fork 0
maimunarashid/javascript-basic
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
This repository contains my learning journey through the fundamentals of JavaScript. It includes hands on examples and practice files that demonstrate key concepts.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published