These are chat archives for FreeCodeCamp/HelpJavaScript

May 2018
May 12 2018 03:22 UTC

function queue(arr, item) {
// 请把你的代码写在这里

return arr.shift(); // 请修改这一行

// 初始化测试数据
var testArr = [1,2,3,4,5];

// 控制台输出
console.log("Before: " + JSON.stringify(testArr));
console.log(queue(testArr, 6)); // 你可以修改这一行来测试你的代码
console.log("After: " + JSON.stringify(testArr));

anyone help me ,i don't know where is wrong
May 12 2018 03:27 UTC
@M-cq arr.push(item) check your spelling for the item argument.
@Ohshi60 Yeah, promises are a steep curve for many people. Just think of it as a way for your program to say "I promise I will return something to you in the future".
May 12 2018 06:07 UTC
thank you so much @ehutchllew
May 12 2018 06:07 UTC
m-cq sends brownie points to @ehutchllew :sparkles: :thumbsup: :sparkles:
:cookie: 374 | @ehutchllew |
May 12 2018 06:08 UTC
@GitHub-Henry ok
Stephen James
May 12 2018 12:15 UTC
@Ohshi60 Promises just move the callback inside the then function - you still have to provide callback it just looks more linear
function withCallback(params, () => { handle callback });
function withPromise(params).then(() => { handle callback });
May 12 2018 14:29 UTC
Will Foster
May 12 2018 16:05 UTC

A question re: JS -

I am building a calc for FCC challenges, I have a global const variable that I am seemingly able to change from within a function. Why is that possible? I though const meant it's value couldn't be changed from anywhere? I am also able to append to it as well...

Luka Dadiani
May 12 2018 16:19 UTC
@Will5592 share a codeine so we can take a closer look?
Anyone here know much about JW player? I have a licenced copy but cant seem to get it to load. Any tips ?
Trying to play a video stream from a js function
Or maybe other free and open JS lib that will enable support for streaming video reliably on a page
Will Foster
May 12 2018 16:30 UTC
@lukadadiani_twitter Sorry, what is a codeine? My code?