Community
Pavel Perminov 23 August 2017 →
Do I need to develop some "through ass" regex because of JS did not support look behind? Or this exercise is a some kind of feature?
Tell me please, why this solution doesn't work?
const isPrime = (num) => {
for (let i = 2; i <= num && num%i !== 0; i++) {
if (i === num) {
return true;
}
}
return false;
};
export default isPrime;
OUTPUT:
FAIL __tests__/solution.test.js
● prime
expect(received).toBeTruthy()
Expected value to be truthy, instead received
false
at Object.<anonymous>.test (__tests__/solution.test.js:14:65)
Hi! Thank you for such awesome lessons! This task is very tough, however. Even after looking at the teacher's solution I didn't understand the last part, namely, why we need 'end' in it?
return begin + sequenceSum(begin + 1, end);
I don't see how it's used in the function: we don't use it for addition. Could you please explain? Thank you!
Help me, please. I don;t understand my mistake. The Output said so amasing thing: ` FAIL tests/solution.test.js ● solution
expect(received).toBe(expected)
Expected value to be (using ===):
"Hello, World!"
Received:
", !"
at Object.<anonymous>.test (__tests__/solution.test.js:4:79)
✕ solution (6ms)
Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total`
My code is:
```import * as strings from './strings';
// BEGIN (write your solution here) const solution = (str) => { let result = ''; for (let i = 0; i < strings.length(str); i += 1) { if (strings.toUpperCase(str[i]) === str[i]) { result = result + str[i]; } }
return String(result); }; export default solution; // END
What's wrong with letters?
As for me, the cause lies in the
if (strings.toUpperCase(str[i]) === str[i]) { result = result + str[i]; }
console.log ("Hello, World!");
Hello! I can't understand why my solution doesn't work. Can you please explain what does this OUTPUT mean?
make: Entering directory '/usr/src/app'
suppressor pass 'RESULT=pass babel-node test.js'
suppressor fail 'RESULT=fail1 babel-node test.js'
suppressor fail 'RESULT=fail2 babel-node test.js'
suppressor fail 'RESULT=fail3 babel-node test.js'
suppressor fail 'RESULT=fail4 babel-node test.js'
#
Expected tests to fail, but they passed. See output above.
Makefile:2: recipe for target 'test' failed
make: Leaving directory '/usr/src/app'
make: *** [test] Error 1
Run failed! Check and fix errors above!
Hey! In the lesson notes you skipped symbol "+" after variable "name" in the phrase: console.log("His name is " + name " and his age is " + age);
Select the incorrect statements: (Select all correct answers)
whatcanIdo?
Николай Артамонов 16 February 2017 →
What with code-style in teacher's solution? I think it's not very good/