Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple example of isNaN() #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add simple example of isNaN() #32

wants to merge 1 commit into from

Conversation

ManuelOviedo
Copy link

#31

Copy link
Member

@TheSTL TheSTL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ManuelOviedo ,
We need native implementation of isNan function.

@ManuelOviedo
Copy link
Author

ManuelOviedo commented Oct 10, 2019

Hello @ManuelOviedo ,
We need native implementation of isNan function.

There's no prototype of isNaN. That property comes from ECMAScript convention for evaluate if a given value is NaN, if you get to the MDN links there are some links to its own ECMAScript related articles.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN
https://tc39.es/ecma262/#sec-value-properties-of-the-global-object-nan

@TheSTL
Copy link
Member

TheSTL commented Oct 10, 2019

Can you write a program which simple take a string as an input and check if its a number or not.
If it's a number return false, else return true. @ManuelOviedo

@ManuelOviedo
Copy link
Author

Can you write a program which simple take a string as an input and check if its a number or not.
If it's a number return false, else return true. @ManuelOviedo

I think you missunderstood the purpose of that function. isNaN checks for a value if it's NOT a number and i guess my example is way too clear:

Number.prototype.isNaN = function(testValue){
return isNaN(testValue);
};
the above example (same as PR) receives a value and evaluates it with isNaN function and will return true if it's not a number or false if it's a number

@TheSTL
Copy link
Member

TheSTL commented Oct 10, 2019

Implementation should be done without using in-build functions or specifically don't use isNaN function, or parseInt type of functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants