Skip to content

Conversation

AlexGit2012
Copy link

Copy link
Collaborator

@vramaniuk vramaniuk left a comment

Choose a reason for hiding this comment

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

Please, try to follow these rules https://javascript.info/coding-style

I'll mark the PR as "Draft", please click "ready for review" when it will be finished. Thank you!

*/
function concatenateStrings(value1, value2) {
throw new Error('Not implemented');
return (value1+value2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

spaces around operators

Please, try to follow these rules https://javascript.info/coding-style

*/
function getStringFromTemplate(firstName, lastName) {
throw new Error('Not implemented');
return ("Hello, "+firstName+" "+lastName+"!")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment on lines +102 to +108
while (value[0] === (" ") || value[0] === ("\t")) {
value = (value[0] === (" ") || value[0] === ("\t") ? value.substring(1) : value)
}
while (value[value.length-1] === (" ") || value[value.length-1] === ("\t")) {
value = (value[value.length-1] === (" ") || value[value.length-1] === ("\t") ? value.substring(0,value.length-1) : value)
}
return value
Copy link
Collaborator

Choose a reason for hiding this comment

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

function removeFirstOccurrences(str, value) {
throw new Error('Not implemented');
let pos = str.indexOf(value)
return str.substring(0,pos)+str.substring(pos+value.length,str.length)
Copy link
Collaborator

Choose a reason for hiding this comment

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

*/
function unbracketTag(str) {
throw new Error('Not implemented');
return str.substring(1,str.length-1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

space between parameters

Comment on lines +301 to +302
? new Array(i + 1).fill(null)
: el.toString().repeat(i + 1).split("")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, avoid this code style, if-else is more readable than multiple conditional operators ? :

*/
function get3TopItems(arr) {
throw new Error('Not implemented');
return arr.sort((a, b) => a - b).reverse().filter((el, i) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

function getPositivesCount(arr) {
throw new Error('Not implemented');
return arr
.filter((el, i) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

unused argument i

throw new Error('Not implemented');
return arr
.filter((el, i) => {
if ((typeof el === "number") && (el > 0)) return true
Copy link
Collaborator

Choose a reason for hiding this comment

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

just return ((typeof el === "number") && (el > 0))

Please, see https://javascript.info/logical-operators

Comment on lines +639 to +647
let headArr = arr.filter((el,i)=>{
if (i<Math.floor(arr.length/2)) return true
})
let tailArr = arr.filter((el,i)=>{
if (i>=Math.ceil(arr.length/2)) return true
})
let middle = arr.length%2===0 ? [] : [arr[Math.floor(arr.length/2)]]

return arr.length===2 ? [arr[1],arr[0]] : [tailArr.concat(middle.concat(headArr))].flat()
Copy link
Collaborator

Choose a reason for hiding this comment

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

spaces around operators

Please, avoid this code style, if-else is more readable than multiple conditional operators ? :

@vramaniuk vramaniuk marked this pull request as draft August 27, 2020 15:33
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