« first day (3796 days earlier)      last day (1374 days later) » 

03:14
ok
03:24
@AaditMShah hi :) I remember a long time ago you posted a link about education? How to educate people so they become good at problem solving?
Do you remember that? Do you have the link? Maybe something with lego mindstorms? But I might be misremembering.
Maybe it was a pdf on how education is bad and how to fix it
I don't even know anymore.
user13780186
04:06
Hello dev, I would like to ask how to remove an item to the left/right? for example the array is
['one', 'two', 'three', 'four', 'five'] then the value is 'three'.
data.findIndex(x => x === value); then how to remove the 'four' or 'two'?
user15346521
04:34
hello!!
@KrushnalPatel 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.
05:09
@BadgerCat There's a book about how to learn called Mindstorms by Seymour Papert. You should read that. Don't have the pdf link anymore.
user14949993
05:22
Is it possible to use import statement in a local JavaScript file without nodejs ?
@Ishan 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.
user14949993
Ok
06:07
Hi all
 
1 hour later…
07:31
@BeginnerCoder 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.
1 message moved to Trash can
Hello, can Anyone guide me?
@BeginnerCoder 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.
user13780186
Hi All, how to fix this:
const index = newState.tabs.indexOf(payload['url']);
if (index === -1) {
newState.tabs.push({url: payload, pin: false})
}
even its already added it keep pushing the existing data.'
08:33
Hi, can someone help me ?
I have a image and i want to create a js which increases the margin-top of that image on scroll upto 2600px
so if 2600px then the onscroll function stops
@LakshayKalra 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 hour later…
09:51
@pooja_1205 ? can you help me ?
 
3 hours later…
12:58
Hi
@Explosion 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.
13:24
|| man man
man: "Displays the man page for a bot command" Examples: || man ban
:D
|| man fakeCommand
No manual entry for fakeCommand
@JBis the bold "permission" word is not on new line, for all commands
13:32
yep, fixing
same for "shortcuts"
should be good now. And man link works.
hmm JBis
what is meant with "shortcut"?
(in your view)
Basically alias. You can call the command by using any of the shortcuts.
I got a different output with rtfm
check sandbox
14:14
// If payload is a string
const index = newState.tabs.findIndex( e => e.url === payload );
// If payload is an object
const index = newState.tabs.findIndex( e => e.url.url === payload.url );
 
4 hours later…
18:39
let HTML = document.getElementsByTagname('html')[0];
let new_html = "<html><body></body></html>";

How can I replace HTML with new_html?
By the way, Hi!
@AaditMShah Thanks, I think that was it ;)
18:52
It's been a half-hour that I'm looking for the answer, please, if you know the answer help me.
|| mdn inner html
@X4748-IR ^
Let me try
18:59
Thank you guys. It's solved 🌺!
19:19
Another question, are there any ways to get the whole text of the body tag with line breaks?

document.body.textContent

doens't give me the line breaks
I think I have to iterate through all the child nodes of the body, and then get the text with a line break.

Something like:

let text = '';
for node in nodes:
text += node.textContent + '\n';

It works in my case, but I was hoping to find a better way.
 
1 hour later…
user15022224
20:43
-1
Q: A styled component and makeStyle component is equal?

tuckerI am using the styled-components library to create components: https://styled-components.com/ vs https://material-ui.com/es/styles/basics/ import styled, { keyframes } from "styled-components"; const Feet = styled.div` border-radius: 10px; padding-bottom: 3rem; `; And i can use like this: <F...

@tucker 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.
user15022224
hi guys help me please with this question
user15022224
-1
Q: A styled component and makeStyle component is equal?

tuckerI am using the styled-components library to create components: https://styled-components.com/ vs https://material-ui.com/es/styles/basics/ import styled, { keyframes } from "styled-components"; const Feet = styled.div` border-radius: 10px; padding-bottom: 3rem; `; And i can use like this: <F...

21:23
ive been nailed with downvotes for using parameters as local variables for an IIFE function. Why would this be considered bad practice vs having var / let / const?
@GarethCompton can you give an example?
can i post the question at hand?
sure
@GarethCompton is there anything technically wrong with it, no. But you are misusing parameters and they are semantically different then just local variables. It would confuse me if I was looking at the code.
Where did you learn that or did you come up with it yourself?
21:32
myself tbh, its when i started to learn on my own. trying out different syntaxes and seeking the "type less do more"
as far as consequences are concerned, i would find errors on purpose and learn why,
however when confronted with this, i dont see how its "abuse"
"type less do more" isn't a great modo
in 99% of situations readability is more important than anything else
but the basic question remans, what differentiates the 2 other than placeholders
@GarethCompton i wouldn't call it abuse, i'd call it "misuse". That is not parameters intended purpose. They have a different semantic meaning.
im curious to learn what that is
It's the same idea as using <h1> instead of <p> and then using CSS to style it the same. Does it change the end result? no. But it's wrong.
21:34
as per ethic?
@GarethCompton are you asking what the purpose of parameters is ?
yes, like its true purpose other than what I did.
|| mdn parameters
> A parameter is a named variable passed into a function. Parameter variables are used to import arguments into functions.
|| mdn default parameters
read those two links
Okay i have read those two
does it answer your question?
honestly no. As of course functions take inputs and returns an output. to me, sometimes inputs can be used as variables to run within the function, but not out of it. I would be discouraged to do this if there is a syntax error of course.
then the variables themselves also hold their respective values within those names as well. default parameters do this but can be overwritten if a different value is present
It's confusing. You are using parameters even tho they aren't parameters.
21:46
indeed so, ive written code like this with no clear error or demise
im always the person to find odd ways to get stuff done, and as evident, an exile of the norms
That is not a good thing
14 mins ago, by JBis
in 99% of situations readability is more important than anything else
The code in your question is very confusing and difficult to read.
other than making default parameters as variables i get, but anything out of that i messed up on?
or is it all 100% out
Move require calls to the top
that would help >.<
const ftp = require('ftp');
don't deconstruct console
 {log}=console
21:50
sort the modules first, then declare the neccesary
just write out console.log()
also why must i avoid deconstruct console?
 errList|| typeof list === 'object' &&
           list.forEach(
why are you using a forEach which doesn't return anything in a boolean operation ?
huh? the last one got me confused on what you meant
@GarethCompton again, it's unnecessary and confusing. What is log? Is it console.log or some other log function.
21:52
console.log
should be the only log that im concerned thats in programming
I have to ask myself that everytime i see log
or aware
@GarethCompton why aren't you creating a function body for the callback?
 ftp.list(serverFolder+file,(errList,list)=>
           errList|| typeof list === 'object' &&
           list.forEach($file=>
no brackets there for the callback
same thing here:
(errStat,stat)=>
                           errStat || stat.size === 0

                                //will destroy server connection if bytes = 0
                                ?(ftp.destroy(),log('the file has no value'))
honestly didnt felt neccesary as the code works oneline
why are you using ternary operator? just create a function body. Ternary is confusing
21:54
how is: condition ? true : false confusing?
your comments are necessary because your code isn't readable
@GarethCompton when it's stretched like it's hard to follow which match which. If is much cleaner:
would it be better if i make the code into a regular format below to give a translation?
22:07
not perfect but this is better
@GarethCompton ^
ideally you should get rid of callback hell and use promises
here is the alternative
operators like "||" and "&&" only allows to go right if either is true or false
get rid of ternary opreator
ternary is good for this:
const x = someBool ? "yes" : "no";
thats it
i personally dislike declaring variables like that (one const and then commas)
const x = 5;
const y = 10;

is better than

const x = 5, y = 10;
return errList ||
        typeof list === 'object' &&
you are still doing the same thing
look at what i did, use if statements
ok
i see your point
added your link into the question
i guess i will have to use interpretations for now on, and leave my odd code to myself a bit more
22:26
@GarethCompton please don't
23:20
Hi all,

I am a newbie and trying to get a boolean value if regexp matches.

For example:

12/18 is a MM/YY format.

I would like to verify the textbox input to match this format. If it matches return true otherwise false.

I tried different things which doesn't work. So someone please correct me where I am doing wrong?

What i have tried:

str = '1236/53454351256';
regex = /(0?[1-9]|1[0-2])\/([\d]{2})/;

console.log(regex.test(str)) // => true but it should be false
23:35
@Learner you can use the logical or operator "!"
for example:

console.log(!regex.test(str)) if you need it to be true.

however what is method test()?
You mean something like this?

( /^(0[1-9]|1[0-2])\/\d{2}$/).test(str) == true
however for some reason
its showing as true
on the first example
ie: /(0?[1-9]|1[0-2])\/([\d]{2})/.test('1236/53454351256')
your second one does return false
yes may be my regex was wrong.
ye, youre set <3
Thanks
23:40
meanwhile i need to purge what ive learned for the sake of doing it the right way
yes please
or sell my knowledge as meme/curse material
as a lightened joke of course
my last question:

( /^(0[1-9]|1[0-2])\/\d{2}$/).test(periodValue) === true

shall I use, equality operator or the strict equality operator ?
personally i would use strict equality
Thanks a lot @garethcompton
23:44
<3
strict equality helps force the types to be equal
okay cool. Just read more examples to make sure that. Cheers

« first day (3796 days earlier)      last day (1374 days later) »