« first day (3546 days earlier)      last day (1400 days later) » 

12:33 AM
Hi folks
es5.github.io/#x15.4.4.21 in the implementation of reduce, what is k or kPresent ? I am unable to understand
It seems like checking for length of array, without resorting to .length property
 
 
2 hours later…
2:14 AM
@aXuser264 meeee, and thanks!
 
 
2 hours later…
4:36 AM
@shortCircuit it's not the array length. That's covered by step 2. And in step 3. the length value becomes the len identifier. The identifier k serves as a counter through the iteration as it starts at zero, the algorithm continues while k < len and in all cases k is increased by 1 at every step - see 8.b.iv. and 9.d. The kPresent value serves as a check to see if this index exists on the object.
To be honest, I don't quite understand the 8. and 9. branches there.
I may be reading it wrong, but they seem to be competing, since both times you repeat while k < len. They also take very similar steps but in 9. it's actually calling callbackfn. So, it seems that it should be using 8. if there is no initial value then switching over to 9 afterwards.
Actually, I'm super dumb - that's *exactly* what it does, I missed 8.b. - repeat while `kPresent` is `false` is what it says. So the 8. branch is only there to ensure `reduce` finds an initial value if none is supplied. So you go through the object looking for a value to use. If none is found by the end (`k < len` is false) you fall into 8.c. and throw a TypeError as the object is empty (as far as `reduce` is concerned). When a value *is* found at 8.b.iii then it's set as `accumulator`and you continue with 9.
 
 
3 hours later…
8:11 AM
Hello folks. I am a little confused regarding connection management in Node.js +mysql.
I'm building a project in React with a Node.js backend which interacts with mysql.
The current architecture is: React front-end interacts with local Node.js "server" which in turn queries a shared mysql db.
So a client is React+local "server".

First: Are there any reasons this is a terrible idea and I should use a single Node server instead of one per client? Note that this is not a "web app" but a local application. The db may or may not be in hosted in the cloud.
 
@VegasVed Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
Thank you all, in advance, for your help :)
 
Hi. I'm a little lost as to what MMO games are. For example, Elder Scrolls Online. Do games like this play like the offline version (complete a task, move to the next), other than many (all) characters in villages / caves / dungeons are other players? I know this isn't a site for games, but many programmers are also gamers
 
Really need some help with this
0
Q: Dropdown calculate scrolltop

BatmanI'm trying to have a dropdown component scroll when I use the down key. I'm having issues getting the measurements correctly so that the selected item is at the bottom of the container box. Right now it's oddly positioned. Gif example Code: const handleScrolling = () => { // I pass in a ref...

 
8:24 AM
No idea what you're trying to achieve even with the gif. Also, where does selectedOptionRef come from
 
items:
item1: {price: "10.99", description: "delicious stick rice", name: "sticky rice", instruction: "please keep it warm"}
item2: {name: "mango sticky rice", price: "4.99", description: "perfect desert ", instruction: "no mango please"}
item3: {price: "8.99", name: "laos sausages ", insrtuction: "not to spicy please", description: "laos sausages, made with pig"}
__proto__: Object
how do i loop thru that in angular?
 
google "js loop through object" ?
 
ive tried everything
 
You have not tried everything
:)
 
> __proto__: Object
is usually an indication that it's just a plain object
but it could be that what you have shown is not clear
items is probably an object holding multiple objects
look at the structure of the data
it should reveal how to loop through em
a basic programming thing
 
8:42 AM
@MyDaftQuestions what do you mean? Technical implementation or just from gameplay perspective?
 
 
1 hour later…
10:05 AM
@helloworld Just make it an array but rather object
this.items = Object.values(items); // then loop `items` in the template
 
 
2 hours later…
12:08 PM
I'm wondering if modern smart electronics like brewing machines actually implement http status code 418 correctly.
2
 
bastard :P
 
12:45 PM
@paul23 I'm pretty sure there are at least a couple of things implementing 418
 
1:07 PM
fortunately 418 isn't a standard
that number is still free to be standarized
but I am just bawling because barely anyone follows the standard strictly
 
1:18 PM
;0
They were really ahead of their time in 1998
 
Hi everyone
 
@Reza Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
1:36 PM
Hi
 
2:51 PM
@VLAZ Thanks man
 
C# isnt normal
and the people who write the tutorials for it are wrong in the head
WHO PUTS SPACES AFTER A METHOD NAME BEFORE THE PARENTHESIS...
WHY
I thought giving Javascript a break would be fine
but now Im just disappointed that people actually write code like this....
PS... A lot of C# users also...

sigh...

Write their increments and decrements as "i --;" and "i ++;"
more useless disgusting spaces
 
how about
console.log( text )
 
3:28 PM
@Wietlol i think that may be familiar
 
@AlareesSamer Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
3:46 PM
so far, I have only seen one person do that
 
4:19 PM
@MisterSirCode XD XD
 
 
1 hour later…
5:20 PM
1
A: sequelize migrations not running

thexymanSo the issue was with node versions. I probably should have provided more context to start of with but I switched laptops and on new laptop I had version 14.1.0 installed whereas on old laptop I had version 10.13.0 installed!. So switching versions did the trick.

Any guesses what changed in v14 that broke this? I'm just looking for a place to start
 
 
1 hour later…
6:41 PM
This "kata" is funny:
https://www.codewars.com/kata/53dbd5315a3c69eed20002dd/train/javascript
This was my solution (try it, it works) but it didn't pass:
function filter_list(list) {
    var length = list.length;

    for (var iterator = 0; iterator ^ length; ++iterator)
    if (typeof list[iterator] == "string")
    list[iterator--] = list[--length];

    list.length = length; // because JavaScript |:[

    return list
}
Of course, I know array methods exist but hmph!
Although you could say over-engineered since list.filter(x => typeof x != "string") does the job just as well
 
6:56 PM
using a filter would indeed be much easier
> iterator ^ length
that looks very sketchy
it is a nice in-place solution tho
but I doubt many people like such approaches
generally, immutable stuff is more preferred
 
7:10 PM
@Lapys This is what I did with 0 thought lol: codewars.com/kata/reviews/5411f7ec17dc0b7b7e000231/groups/…
 
@DavidKamer Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
function filter_list(l) {
    return l.filter( item => typeof item !== 'string' );
}
 
1 message moved to Trash can
 
Hi folks. I was trying to understand the event loop in nodejs.
nodejs.org/en/docs/guides/event-loop-timers-and-nexttick in here, it says
```
When the event loop enters the poll phase, it has an empty queue (fs.readFile() has not completed), so it will wait for the number of ms remaining until the soonest timer's threshold is reached.
```
but I was of the impression that. in case of async operation, like incase of $.get("some api", callback) then the xhr request is moved to somewhere and then the callback is pushed to queue.
 
7:27 PM
Hello
 
@zerokira Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
 
2 hours later…
9:18 PM
I know there's not much point in worrying about memory management in JavaScript (maybe) but I still have questions, like this one:

Is it better to do this:
```
var array = new Array(length);

for (var iterator = 0; iterator != 10; ++iterator)
array[iterator] = Number.parseInt(Math.random() * 10);
```

than this?
```
var array = [];

for (var iterator = 0; iterator != 10; ++iterator)
array.push(Number.parseInt(Math.random() * 10));
```
Of course, the real performance check will be how the JavaScript interpreter handles the memory under the hood but for the standards that govern JavaScript's design (or just conceptually) is there any throughput in the first code snippet compared to the second
 
Either I have gone mad, or webpack has
ok, i went mad
 
!!magic2
 
I spoke too soon. Still broken
../common/enum/ParticipantRole.ts 1:7
Module parse failed: Unexpected token (1:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See webpack.js.org/concepts#loaders
> export enum ParticipantRole {
how can't it handle a ts file type
 
9:47 PM
it seems to be an issue with the enum
3
Q: Syntax error: enum is a reserved word in typescript

Jie Wumy project was set up with react-typescript, it can work normally excepted declare with key word "enum". typescript 3.0 and above max os enum t { code = 'CODE' } i expected it can compile successfully,but it throw an errow with such a description "Syntax error: enum is a reserved word"

 
10:33 PM
 
good day, trying out react js, came across an issue

const enforceToggle = (id,e) => { console.log(id); }
<a href="#0" onClick={(e)=>enforceToggle('support',e)}></a>

no matter how may times the link is clicked it console logs the id only once, is this the expected behaviour or am i missing something?
 
I don't see a problem. Can you should more code?
|| mcve
 
If you would like assistance, please create a Minimal, Complete, and Verifiable Example
 
alright hold on
in minimising my code to show a working example i realised i had an attribute of data-toggle="dropdown" and once i removed it every thing work fine
i have narrowed my problem down, so i guess my question would be how do i find a way around this
 
10:50 PM
@BobbyAxe Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
 
data toggle, do you have a lib that uses that attribute?
 
yes, bootstrap and some jquery
 
Ok you shouldn't mix react with those libs
17
A: How to use data toggle collapse in Reactjs with Bootstrap?

DavoBootstrap menu toggle is a JS functionality, it's not a good idea to mix the JS part of Bootstrap with ReactJS, since both libraries manipulate the DOM and it can lead to bigger problems. I suggest implementing the small functionality you need, most of the menu toggle is just a class toggle thin...

You shouldn't manipulate the dom with other libs when using react
 
damn i am my own problem
thanks, had scratched my head over this for a while
 
11:04 PM
Np
 

« first day (3546 days earlier)      last day (1400 days later) »