#1-4Task. Anton Demidovich - #781
Conversation
There was a problem hiding this comment.
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!
Please, privide the direct link to your task success travis build
| */ | ||
| function getStringFromTemplate(firstName, lastName) { | ||
| throw new Error('Not implemented'); | ||
| return 'Hello, ' + firstName + ' ' + lastName + '!' |
There was a problem hiding this comment.
| */ | ||
| function unbracketTag(str) { | ||
| throw new Error('Not implemented'); | ||
| return str.replace('<', '').replace('>', '') |
There was a problem hiding this comment.
Please, use just 1 replace with regexp
| for (var h=0; h<height; h++) { | ||
|
|
||
| if (h===0){ | ||
| shape += '┌' + '─'.repeat(width-2) + '┐\n'; | ||
| }else if (h===height-1){ | ||
| shape += '└' + '─'.repeat(width-2) + '┘\n'; | ||
| } | ||
| else{ | ||
| shape += '│' + ' '.repeat(width-2) + '│\n'; | ||
| } | ||
|
|
||
| } | ||
| return shape; | ||
|
|
There was a problem hiding this comment.
Please, try to follow these rules https://javascript.info/coding-style
HERE and below (spaces around operators)
| if (typeof value === 'string' || value instanceof String) | ||
| { | ||
| return true; | ||
| }else { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
just return (typeof value === 'string' || value instanceof String)
Please, see https://javascript.info/logical-operators
| */ | ||
| function getDistanceBetweenPoints(x1, y1, x2, y2) { | ||
| throw new Error('Not implemented'); | ||
| return Math.sqrt(Math.pow((x1-x2),2) + Math.pow((y1-y2),2)); |
There was a problem hiding this comment.
Please, improve using Math.hypot
| function toCsvText(arr) { | ||
| throw new Error('Not implemented'); | ||
| function toCsvText(arr) { | ||
| return arr.map(elem=>elem.join(',')).join('\n'); |
There was a problem hiding this comment.
We don't need any loops here.
Try to solve ising just join
| */ | ||
| function getFalsyValuesCount(arr) { | ||
| throw new Error('Not implemented'); | ||
| return arr.filter(elem=>Boolean(elem)===false).length; |
There was a problem hiding this comment.
return arr.filter(elem=>!elem).length; will work
Please, see https://javascript.info/logical-operators
| throw new Error('Not implemented'); | ||
| let dict = new Map(); | ||
| array.map(each_el => { | ||
| let arr = new Array(); |
There was a problem hiding this comment.
let arr = []; preferable way to initialize empty array
| let dict = new Map(); | ||
| array.map(each_el => { | ||
| let arr = new Array(); | ||
| if (dict.get(keySelector(each_el)) === undefined) dict.set(keySelector(each_el), new Array(valueSelector(each_el))); |
There was a problem hiding this comment.
if (dict.get(!keySelector(each_el))) dict.set(keySelector(each_el), new Array(valueSelector(each_el))); - preferable
| let new_arr = new Array(); | ||
| let arr_index = 0; | ||
| indexes.map(each_el => { | ||
| if (each_el != 0) arr_index = each_el; |
There was a problem hiding this comment.
"operator !== is always preferable
sometimes ''!=' may cause an error
(check at console :
'0' != 0
and '0' !== 0)"
|
Why did you marked this PR as ready for review? |
|
I'll mark the PR as "Draft", please click "ready for review" when it will be finished. Thank you! |
|
And , please, resolve all conflicting files (readme.md, package....) |
I was think i did it ? In my repository all tasks are was fixed |
|
For tasks1-4, task5, task6 ... you should create new branch from master branch and then make the PR |


End my tasks 1-4