← Back to list

JavaScript Concepts(isNaN, parseFloat, parseInt, trim, trimStart, trimEnd )

1. isNaN: isNaN() is a function by which whether the value is NaN or not, that means not a number or not.Example:

Hossain Rabbi · 2021-12-21 08:28 · 0 claps · 1.1 min read
#javascript #isnan #parsefloat #parseint #trimstart
Open on Medium ↗
Wiki topics: 🌐 · Web Development

JavaScript Concepts(isNaN, parseFloat, parseInt, trim, trimStart, trimEnd )

  1. isNaN: isNaN() is a function by which whether the value is NaN or not, that means not a number or not.Example:

console.log(isNaN(3)) output:false

console.log(isNaN(‘hosen’)) output:true

  1. parseFloat: parseFloat() is a method that takes any string and returns a number that the string contains. It returns from the first character till the number end. If the first character is not a number then it will return NaN. It also returns float if strings contain. Example:

console.log(parseFloat(“435”)) output:435 console.log(parseFloat(“12 number house”)) output:12 console.log(parseFloat(“123.4343”)) output:123.4343 console.log(parseFloat(“Home 4343”)) output:NaN

  1. parseInt: parseInt() is a method that takes any string and returns a number that the string contains. It returns from the first character till the number end. If the first character is not a number then it will return NaN. It does not return float if strings contain. Example:

console.log(parseInt(“435”)) output:435 console.log(parseInt(“12 number house”)) output:12 console.log(parseInt(“123.4343”)) output:123 console.log(parseInt(“Home 4343”)) output:NaN

  1. trim(): trim() method removes white space from a string, it doesn’t remove the spaces between words, only removes them from start and end. Example:

let sentence = “ I want to go .”; console.log(sentence.trim()) output:I want to go.

  1. trimStart(): trimStart() method removes white space from a string, it doesn’t remove the spaces between words, only removes them from the start and not from the end. Example:

let sentence = “ I want to go .”; console.log(sentence.trimStart()) output:I want to go .

  1. trimEnd(): trimEnd() method removes white space from a string, it doesn’t remove the spaces between words, only removes them from the end and not from start. Example:

let sentence = “ I want to go .”; console.log(sentence.trimEnd()) output: I want to go.


메타데이터
post_id
e98f008ea30
slug
javascript-concepts-isnan-parsefloat-parseint-trim-trimstart-trimend-e98f008ea30
url
https://medium.com/@mdhosen21018/javascript-concepts-isnan-parsefloat-parseint-trim-trimstart-trimend-e98f008ea30
canonical_url
https://medium.com/@mdhosen21018/javascript-concepts-isnan-parsefloat-parseint-trim-trimstart-trimend-e98f008ea30
author_url
https://medium.com/@mdhosen21018
status
ok
fetched_at
2026-07-27 17:26:30