-
Notifications
You must be signed in to change notification settings - Fork 188
#1-4Task. Alexei Kolesnikov #928
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
Conversation
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.
I'll mark the PR as "Draft", please click "ready for review" when it will be finished. Thank you!
task/01-strings-tasks.js
Outdated
*/ | ||
function extractNameFromTemplate(value) { | ||
throw new Error('Not implemented'); | ||
return value.substr(7,value.length-8); |
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, don't use this deprecated method.
substring is preferable
task/01-strings-tasks.js
Outdated
var newStr = ''; | ||
for (let i = 0; i < count; i++){ | ||
newStr += value; | ||
} | ||
return newStr; |
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.
task/01-strings-tasks.js
Outdated
throw new Error('Not implemented'); | ||
var cards = "A♣','2♣','3♣','4♣','5♣','6♣','7♣','8♣','9♣','10♣','J♣','Q♣','K♣','A♦','2♦','3♦','4♦','5♦','6♦','7♦','8♦','9♦','10♦','J♦','Q♦','K♦','A♥','2♥','3♥','4♥','5♥','6♥','7♥','8♥','9♥','10♥','J♥','Q♥','K♥','A♠','2♠','3♠','4♠','5♠','6♠','7♠','8♠','9♠','10♠','J♠','Q♠','K♠"; | ||
var array = cards.split("','"); | ||
|
||
for (let i = 0; i < array.length; i++) { | ||
return array.indexOf(value, 0); | ||
} |
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.
Try do not use a loop for solving this task.
Just place the whole deck to array of strings and return index of search string
task/02-numbers-tasks.js
Outdated
*/ | ||
function getRectangleArea(width, height) { | ||
throw new Error('Not implemented'); | ||
return width*height; |
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.
spaces between operators
task/02-numbers-tasks.js
Outdated
*/ | ||
function getCicleCircumference(radius) { | ||
throw new Error('Not implemented'); | ||
return (radius*2)*Math.PI; |
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.
spaces between operators
task/04-arrays-tasks.js
Outdated
function sortDigitNamesByNumericOrder(arr) { | ||
throw new Error('Not implemented'); | ||
var digits = ['zero','one','two','three','four','five','six','seven','eight','nine']; | ||
return arr.sort(function(a,b){ |
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.
spaces between parameters
task/04-arrays-tasks.js
Outdated
*/ | ||
function getItemsSum(arr) { | ||
throw new Error('Not implemented'); | ||
return arr.reduce((acc,v) => (acc+v), 0); |
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.
spaces between parameters and operators
task/04-arrays-tasks.js
Outdated
*/ | ||
function findAllOccurences(arr, item) { | ||
throw new Error('Not implemented'); | ||
return arr.reduce(function(acc,val){ |
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.
spaces between parameters
*/ | ||
function distinct(arr) { | ||
throw new Error('Not implemented'); | ||
return Array.from(new Set(arr)); |
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.
Excellent!!
task/04-arrays-tasks.js
Outdated
throw new Error('Not implemented'); | ||
let result = null; | ||
indexes.map((dimension, index) => { | ||
if (index != indexes.length - 1) arr = arr[dimension]; |
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.
"operator !== is always preferable
sometimes ''!=' may cause an error
(check at console :
'0' != 0
and '0' !== 0)"
Revert changes of this file task/10-katas-1-tasks.js |
…dId(); fixed: Coding style;
Changes in file 10-katas-1-tasks.js shouldn't be in this PR. Please, execute the command I'll mark the PR as "Draft", please click "ready for review" when it will be finished. Thank you! |
Closing the PR as accepted! Thanks! |
travis-ci: https://travis-ci.org/github/AleshaKolesnikov/js-assignments/builds/719550067