« first day (4724 days earlier)      last day (446 days later) » 

00:18
||quietday
What did the Java code say to the C code? You've got no class.
 
2 hours later…
02:42
at least people still like C
 
2 hours later…
user12582392
04:18
are there some typescript wizards here
07:19
that's a good question. Btw I remember a great learning material for TypeScript. I can't find it anymore
does anyone know where it is? I remember it was like going through different concepts. "your company get on the new band wagon and change all your stuff to FRP"
on the later stages I had to write nice recursive types and all
||tumbleweed
ah, that still exists
07:35
yeah. Nice
 
2 hours later…
09:57
Hi guys you know my last question was completly trash and i found the answer i have another question which is about this
in this game as i said sometimes ago we have a cannon which fires and some zombies and i want when the cannon is shooted and came to ground again make an explosion with an animation
 
2 hours later…
12:25
Hi all, I had to remove node_modules folder from my project directory for fixing some issues related to one of the npm packages that is being used. I used the rm -rf command for the same. Now, is it possible to bring back the deleted npm_modules folder? If not, how to generate a new npm_modules folder for my project directory?
@Ankit 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.
@Ankit npm install?
@ntohl
@ntohl running npm install is giving me this error:

npm ERR! code E401
npm ERR! Incorrect or missing password.
npm ERR! If you were trying to login, change your password, create an
npm ERR! authentication token or enable two-factor authentication then
npm ERR! that means you likely typed your password in incorrectly.
npm ERR! Please try again, or recover your password at:
npm ERR! https://www.npmjs.com/forgot
npm ERR!
npm ERR! If you were doing some other operation then your saved credentials are
12:41
npm login? :D
It's almost like reading is a necessary skill
@ntohl it prompts me to enter a username-password combination, and I am not sure of what to enter here.
@BenFortune Good one @BenFortune!! :D
You have a private package in your package.json that requires authenticating with npmjs.com
@BenFortune is there a way to know which package is that?
Generally prefixed with an @
Not always though
12:49
@BenFortune there are several packages like that, I am trying to get the npm_modules from another colleague now, as a workaround. Thanks guys!
I would advise against that
Unless you have the exact same setup (same node version, same package.json & package-lock.json)
@BenFortune but we have access to the same repository and similar versions for node.js, package.json, and package-lock.json
similar might not be good enough
@BenFortune I meant same, not similar. My Bad.
If it works it works, but it's not the right way
12:55
@BenFortune sure, I understand that. Programming Meme fraternity agrees! If it works, It Works!
13:18
this is the check I make for undefined if(typeof array[index + 1].day__days!=='undefined')....despite the check though the object is still accessed and I get the usual udefined error in the console...why?
@DimitrisPapageorgiou hey there!
If it's returning an object, it's not undefined
oh...how to make the check then?
13:42
it is returning undefined....I get the message in the console
14:38
!!||
|| say ||
@DimitrisPapageorgiou What exactly is the error?
this particular error message is very often misunderstood
15:06
@KevinB just a moment
search.js:5 Uncaught TypeError: Cannot read properties of undefined (reading 'day__days')
if(typeof array[index + 1].day__days!=='undefined')
at some point the index i want to access does not exit
but since I am making a check the error should not appear
right, so, the error is telling you array[index + 1] is undefined
you cant access a property of undefined
so your condition would need to drop days__days to catch that
yes but I am placing the whole expression into an if statement.....so checking it would not produce the error
but it does
no, that's false
the condition only checks what you tell it to
3202
Q: Detecting an undefined object property

Matt SheppardHow do I check if an object property in JavaScript is undefined?

so you are saying that despite the check the error will appear anyway?
if it fails to access the property you want to test, it's gonna throw an error before it reaches the conditional
in x.y.z === 1, it can't test what the value of z is if it can't access z
so it will not go within the brackets...
!!mdn optional chaining might help
yes it worked....first time i use it
15:21
if(typeof array[index + 1]?.day__days!=='undefined')
means you're checking for undefined in both locations, does the index exist, and does it have the day__days property and is it defined
i tried something else and desipite being undefined I DID NOT GET THE ERROR....weird
if(typeof array[index + 1] !== 'undefined')
at some point the index is undefined....no error though
that should in fact not throw an error
because array is never undefined
15:27
> search.js:5 Uncaught TypeError: Cannot read properties of undefined (reading 'day__days')
here though a check is made about an array being undefined stackoverflow.com/questions/13107855/…
The error is telling you it failed to access day__days because undefined can't have properties
it's not telling you day__days is undefined
it's telling you it can't even access day__days to make that check
hm
i see
did not kknow these litle details
15:29
you'd get the same error message if you moved that line of code outside of the if statement
array[index + 1].day__days
did it allready
if you removed the .day__days the error would go away, because you're no longer trying to access a property on an undefined value, ;)
 
2 hours later…
17:50
posted on September 22, 2023 by Ben Mason

The Dev channel has been updated to 119.0.6020.3 for Windows, Mac and Linux. A partial list of changes is available in the Git log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Prudhvi Bommana Google Chrome

18:24
Hey there, who here is good at React? I have a question
!!welcome
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.
So I started practicing with the useReducer hook in React (which obviously takes a reducer function as its first argument)

My code works fine, but I just realized something: if I define the reducer function inside of the component, my page wont even render, but if I define it OUTSIDE of the component (basically above the component), everything works the way its supposed to

Why is that so? Why can't I define the reducer function within the component as well?
do you have a code sample?
Usually when it doesn't render, more information exists, an error perhaps,
sure, just a very basic counter component, where I wanted to test some things
18:31
@popsmoke Please don't post unformatted code - use the up arrow to edit your post, then hit Ctrl + K to format the code in that post. 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
!!choose "continue existing save" or "start a bounty hunter"
start a bounty hunter
1 message moved to Trash can
in chat, blocks (such as code) should be separate from text that accompanies it
`import "../App.css";
import { useReducer } from "react";

const reducer = (state, action) => {
    switch (action.type) {
      case "increment":
        return { count: state.count + 1 };
      case "decrement":
        return { count: state.count - 1 };
      default:
        throw new Error();
    }
  };


const ReducerComp = () => {
  const initialState = { count: 0 };
  const [state, dispatch] = useReducer(reducer, initialState);


  return (
    <div className="flex flex-row border p-5 items-center gap-5 justify-center">
it doesn't support mixing the two
18:32
my bad, i think this works, is it correctly formatted?
yeah that's fine
so this works perfectly, nothing too special - however, if i would define that reducer function within the Component below, it would NOT render
and thats weird, how come?
i suppose you're asking why moving the definition of reducer into the ReducerComp doesn't work then? i'd assume it's something to do with how hooks in general work
if you place it inside the component, it will get redefined every time the component renders
but i haven't really messed with react all that much since the introduction of hooks, so i haven't spent much time understanding how they work under the hood.
thats true, I havent thought of that

i just believe that I've witnessed helper functions of hooks being written within the component itself, but yeah, your explanation is very logical
I think in some cases you want to define helper functions within the hook itself
18:35
i havent used useReducer that much, thats why im trying to finally get my hands dirty with it lol
but outside of them? i'm not sure
regardless, thanks a lot for your help!
maybe someone else can clarify it fully

« first day (4724 days earlier)      last day (446 days later) »