Skip to content

Homework#1

Open
nimeshmino wants to merge 3 commits into
mainfrom
homework
Open

Homework#1
nimeshmino wants to merge 3 commits into
mainfrom
homework

Conversation

@nimeshmino

Copy link
Copy Markdown
Owner

No description provided.

@nimeshmino nimeshmino requested a review from pivee January 4, 2023 18:43
Comment thread src/index.js Outdated
* Write a function that joins two strings
*/

function newFunction() {} No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Try to have fewer comments in your code, but always try to make the codebase readable, and comprehensible by giving meaningful names to the functions and variables. In this scenario, you could name the function to be something like joinTextStrings so that it tells the reader what it does.

Also keep in mind that you shouldn't be too specific either. For example, if you name the function to be joinTwoTextStrings, then if you have to extend this functionality to join three, then it makes things complex.

Once you switch to TypeScript, using good-practices will become even easier. That would help you to write something like the following snippet:

/**
 * Takes an array of strings, joins them using " " characters between each,
 * and returns the result as a string.
 */
function joinTextStrings(textStrings: string[]): string {
  return textStrings.join(" ");
}

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