Skip to content

Conversation

@AMSHL
Copy link

@AMSHL AMSHL commented Jul 17, 2019

All 10 functions finished - No global vars, no ES6.

Copy link

@DanilRostov DanilRostov left a comment

Choose a reason for hiding this comment

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

Good job. Unfortunately 3.js doesn't work at all.

splitAndMerge("Hello World!",",") should return "H,e,l,l,o W,o,r,l,d,!" */

function splitAndMerge (str, sp) {
target=str.split(' ').join('').split('').join(sp);

Choose a reason for hiding this comment

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

Not a good way to declare a variable

Copy link
Author

Choose a reason for hiding this comment

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

You mean the "target" variable? What would be better way?

Copy link
Author

Choose a reason for hiding this comment

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

Oh... Now i got it - fixed

target=str.split(' ').join('').split('').join(sp);
return target
}
console.log(splitAndMerge("Hello there!",","))

Choose a reason for hiding this comment

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

Current output is H,e,l,l,o,t,h,e,r,e,! instad of H,e,l,l,o t,h,e,r,e,!

Copy link
Author

Choose a reason for hiding this comment

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

but... well... it seems to me that i've been confused with this
splitAndMerge("My name is John"," ") should return "M y n a m e i s J o h n"
(no extra spaces here)

am i missing some logic of how function should work?

})
return target.join('');
}
console.log(toCamelCase("the-stealth-warrior"));

Choose a reason for hiding this comment

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

please try to run this file in Node.js. I get this output
image

Choose a reason for hiding this comment

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

the same in the browser
image

Copy link
Author

Choose a reason for hiding this comment

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

Fixed. Forgot about arr.splice(n,1);

Function.prototype.myBind = function () {
var target = this;
var args = arguments[0];
curArgs = [].slice.call(arguments, 1);

Choose a reason for hiding this comment

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

Why you didn't write var or const here?

Copy link
Author

Choose a reason for hiding this comment

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

fixed

curArgs = [].slice.call(arguments, 1);
return function() {
var newArgs = [].slice.call(arguments);
targetArgs = curArgs.concat(newArgs);

Choose a reason for hiding this comment

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

And here

Copy link
Author

Choose a reason for hiding this comment

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

fixed

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