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

fixes #3; match var names in README & index.html #4

Merged
merged 3 commits into from Jul 24, 2015
Merged

fixes #3; match var names in README & index.html #4

merged 3 commits into from Jul 24, 2015

Conversation

shaheenp
Copy link
Contributor

fixes #3

Solution:

  • check if M is a whole number (e.g. 0, 1, 2, ...)
  • check if N is a natural number (e.g. 1, 2, 3, ...)

Also, the variable names in the README's instructions were different than the ones in index.html so I synced them up.

if(/^[0-9]+$/.test(str)) {
return Number(str);
}
return NaN;
}

function parseNat (str) {
if(/^[0-9]+$/.test(str) && Number(str) !== 0) {
Copy link
Owner

Choose a reason for hiding this comment

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

how about just:

var whole = parseWhole(str);
return whole === 0 ? NaN : whole;

to avoid code duplication?

@shaheenp
Copy link
Contributor Author

@wgreenberg good call

wgreenberg added a commit that referenced this pull request Jul 24, 2015
fixes #3; match var names in README & index.html
@wgreenberg wgreenberg merged commit b562ac2 into wgreenberg:gh-pages Jul 24, 2015
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.

Cannot read property 'length' of undefined
2 participants