-
Notifications
You must be signed in to change notification settings - Fork 70
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
Added new helpers for square root, word count, random string #62
base: master
Are you sure you want to change the base?
Added new helpers for square root, word count, random string #62
Conversation
djunehor
commented
Oct 2, 2019
- helper function to return square root of a number
- helper function to count number of words in a word
- helper function to split a string to an array
- helper function to return random string of specified length
* | ||
* @returns {number} | ||
*/ | ||
function nombalasan (args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use camel casing. nonbaLasan
* | ||
* @returns {number} | ||
*/ | ||
function igunmerin (args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use camel casing. square root is Irìn kejì
in yoruba
@@ -0,0 +1,18 @@ | |||
/** Takes any number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add test cases for each of these methods
var result = ""; | ||
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | ||
var charactersLength = characters.length; | ||
for (var i = 0; i < length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use let
for block variables
*/ | ||
function yipooro (args) { | ||
if (Array.isArray(args)) { | ||
let [ length, ] = args; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
is preferred in yorlang codebase whenever a variable is not re-assigned
* | ||
* @returns {number} | ||
*/ | ||
function iyeoro (args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use lowerCamelCasing
* @param {string} str - receives a string and returns the length | ||
* @returns number | ||
*/ | ||
function pipoto (args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already an helper method ka
that does this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing helper function ka
is to count number of elements in an array. This helper pipoto
is to count the length of a string.