« first day (3464 days earlier)      last day (1467 days later) » 

user11867329
1:46 AM
I know kevin knows the issue
 
user11867329
he's just a good guy
 
user11867329
and allows me to find it for myself
 
user11867329
Is there a way to let a .toggle be active?
 
user11867329
on load?
 
user11867329
e.g. already toggled?
 
Tay
2:18 AM
Im so utterly confused, why isnt my animation frame working, I have it debugging... ITS NOT LOOPING... god ffs javascript is just not loving me today
 
2:45 AM
why should we use css-loader and style-loader in webpack over including a .css file at the top of a page?
 
Tay
3:01 AM
It doesnt matter
and also, just use CSS files when you can, its cleaner.

Unless you have like KB/ps wifi, (which nowadays is kinda irrelevant) you never need a style tag
 
3:12 AM
Some one help
How can I update a function constantly
I have this function and I want the function to be updated every second
 
@OakDev 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.
 
user11867329
but already loaded
 
user11867329
with no click
 
user11867329
like, already toggled
 
1 message moved to Trash can
 
user11867329
3:16 AM
$(#clickme1).ready() {
$( ".elementor-element-762ca62e" ).toggle( function() {
});
});
 
@learner you need to use a timer or setInterval ---
setInterval(function(){ alert("Hello"); }, 3000);
 
That is going to execute alert every 3 seconds?
 
Thanks man!
 
Sure thing - gl
 
user11867329
3:24 AM
and me?
 
user11867329
do me next
 
Still stuck on that toggle issue?
 
user11867329
yesh]
 
user11867329
I mean once I get it fixed
 
user11867329
I got about 1 last real issue
 
user11867329
3:25 AM
and then the automation
 
user11867329
THEN
 
user11867329
the real world problems
 
That one didn't work on the actual page but did work in the JSFiddle, right?
 
user11867329
traffic
 
user11867329
Yes
 
user11867329
3:26 AM
I figured maybe theres a way to toggle on load
 
user11867329
like, already toggled once
 
user11867329
without .click
 
That is pretty strange - did you try using the !important for display: none?
there is
 
user11867329
Yes, no changes
 
user11867329
I'd let you try on-page
 
user11867329
3:27 AM
it's not like I'm paranoiac about that
 
user11867329
toggle works fine
 
user11867329
So I know I can, worst comes to worst, have two toggle elements
 
user11867329
instead of one that handles both (Since this also doesn't work)
 
user11867329
but there still needs to be one hidden
 
user11867329
on load
 
3:30 AM
So what is the issue then lol
 
user11867329
but there still needs to be one hidden
on load
 
so... set it to hide() on page load?
 
user11867329
You don't seem to remember, so let me re-ask my resumed question
 
Or, have you tried simply putting display: none; directly into the <section> tag?
 
user11867329
Is there a way to make a .toggle function already toggled on load?
 
user11867329
3:31 AM
$(#clickme1).ready() {
$( ".elementor-element-762ca62e" ).toggle( function() {
});
});
 
<section class="elementor-element-762ca62e" style="display: none !important"></section>
 
user11867329
I already tried, when you suggested it earlier.
 
user11867329
and it did not work
 
user11867329
SO
 
@OakDev 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.
 
3:32 AM
That was changing it via JS, I'm saying apply it directly to the HTML
 
user11867329
As I also already told you
 
1 message moved to Trash can
 
user11867329
For it to work via CSS it requires an elaborate class nomenclature
 
user11867329
and using that same nomenclature with .css() doesnt work
 
user11867329
SO
 
user11867329
3:33 AM
Is there a way to make a .toggle function already toggled on load?
 
user11867329
$(#clickme1).ready() {
$( ".elementor-element-762ca62e" ).toggle( function() {
});
});
 
@OakDev 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.
 
$( document ).ready(function() {
    $( ".elementor-element-762ca62e" ).toggle( function() {
    });
});
 
user11867329
1sec
 
user11867329
lemme try
 
user12960916
3:36 AM
hi, i'm trying to do some simple validation for a name and password entered in a page. i have a function that will show the user some errors if they don't put anything for name & password but i'm having trouble getting my div errors to show. i'm not sure what i'm doing wrong, here is my code
 
user12960916
<form>
        <label for="name" id="loginname">Name:</label><br>
        <input type="text" id="name" value=""><br>
        <label for="password" id="loginpassword">Password:</label><br>
        <input type="password" id="password" value=""><br><br>
        <input id="submitlogin" type="button" value="Submit" onclick="validateLogin();" />
      </form>

      <div id="nameerror"></div>
      <div id="passworderror"></div>                                                                     //When page loads everything in this function will execute
 
That is the standard for "on page load" for jQuery.
 
user11867329
@MidnightlyCoder This works! Talk to me, what'd you do?
 
So the below is used whenever you want something to happen on page load in jQuery:

    $( document ).ready(function() {
        // Code you want to run
    });
 
@MidnightlyCoder 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.
 
user11867329
3:38 AM
Delete (I read)
 
user11867329
Thanks a million
 
user11867329
I'll work with that, no issue
 
Yep, sure thing - gl
 
user11867329
If I get issues with pagespeed and GTmetrix stuff, I'll come be belligerent again
 
I hate pagespeed lol
 
user11867329
3:39 AM
If you need some stories about stuff, holler.
 
@csscoder - What is/isn't happening in your code? Any errors in the console output?
 
user11867329
@MidnightlyCoder want $5?
 
user11867329
I got $5
 
@OakDev - No worries, pass it on!
 
user11867329
Yeah idk man
 
user11867329
3:42 AM
laws and shit
 
user12960916
i'm getting validateLogin is not defined
 
user12960916
i also used the wrong id, i put the labels id instead of the input boxes but i fixed that and still nothing on the page
 
@csscoder - Have you tried moving your validateLogin function outside of the window.onload = function() {?
Also it should most likely be in <script> tags, such as:
<script type="text/javascript">
    // Your function here
</script>
I don't think the onload is needed at all from what I can see
 
user12960916
i changed it to: window.onload = function() {

    this.validateLogin();
}
function validateLogin() {
 
Anyone know which reporter is the fastest among all mocha built-in reporters?
 
user12960916
3:47 AM
i put it in the onload assuming that function should run when the page first loads incase the user just hits submit which they probably wont but
 
In that case you should be checking for the form submission in general, as it's still only going to work for the actual submit button
75
Q: Capture a form submit in JavaScript

mrwoosterThere seems to be lots of info on how to submit a form using javascript, but I am looking for a solution to capture when a form has been submitted and intercept it in javascript. HTML <form> <input type="text" name="in" value="some data" /> <button type="submit">Go</button> </form> When a u...

 
user12960916
i'm not actually submitting anything though the page is a fake login just to make sure the user enters in some credentials in order to be taken to another page, would you still recommend checking for the form submission in general?
 
4:01 AM
if you are worried that users will hit "enter" to submit the form, then yes -- if you're assuming they'll only click the submit button then no
either way though, the onclick should work once you move it outside the onload - setting up a JSFiddle may help troubleshoot it further if needed
 
user12960916
 
user12960916
i put it outside the onload, still nothing
 
1 sec
And with the onload removed - jsfiddle.net/ou3kfre2/7
Only issue I saw was that you were using document.getElementById("nname").value; with an extra "n" lol
 
user12960916
ohh thats why lol thank you
 
sure thing, gl!
 
user12960916
4:17 AM
if they click that button and i want to redirect to another page, is there a way to do that in javascript or would it be using href in html, do you know? because inputs don't have hrefs so would the only way be to use an anchor tag with an href next to it?
 
user12960916
i usually make the button a link but ive never made an input with type button a link
 
4:28 AM
 window.location.replace("http://stackoverflow.com");
 
user11867329
@deostroll Cathy Newman
 
user11867329
5:01 AM
@Unbreachable I shit in bags.
 
okay
?
night o/
 
5:17 AM
3 messages moved to Trash can
 
Thanks
 
Drugs/Alcohol were def involved with the creation of those messages lol
 
I have no doubt
 
5:50 AM
lol
 
 
2 hours later…
7:49 AM
hi guys
my question is
suppose I have a REST call that return me string that represents the date (ex 20/20/2020)
I create a model Student that has a date like field
date :Date
when i call the api getStudentList('/api/...).subscribe{(response: Student)=>{return response} }
I associate the student list to json but when I print in template {{student.date}}
it prints me nothing
how can I resolve this Angular problem
 
8:28 AM
how do you get rid of an object that has a name representing it. Do I need to even be concerned with it? It is not a property but it is the class name and I'd rather it not be there.
 
Hi everyone!
 
@donutDonut123 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.
 
Anyone here have experience with webpack, vuejs and building reusable single file components?
Because I have such two problems: does webpack includes the template part while building *.vue file into final *.js script and how to pass props to that built component, when embedded inside some 3rd party webiste in <script> tag?
 
9:09 AM
@ChristianMatthew what do you mean?
 
9:26 AM
@ChristianMatthew do you mean that you have a class instance and it shows what this is an instance of?
 
that's what I was thinking as well, but if it's true, he has a weird use case then
 
@KarelG indeed, I agree. Still, it shouldn't be too hard honestly - copy all properties into a plain object. This will get rid of the inheritance and the console wouldn't show it. Still, it might break stuff, depending on how the inheritance is used. Also, if you'd be creating an instance then getting rid of the inheritance, you may as well just drop the whole hierarchy thing and look into mixins + composition to create objects.
 
10:07 AM
hi
I'm installing a project and set npm config set strict-ssl false
to get past UNABLE_TO_GET_ISSUER_CERT_LOCALLY warning
but one package I'm installing from a private npm registry still shows this error during install
https://npm.forge.doodle.com/repository/doodleclient/@doodleclient/shared-library
Is there a way to change this registry to point to http instead in npm config?
I though npm config set strict-ssl false should allow fetch from all registries regardless of cert issues
 
no errors?
could be that you are getting unable_verify_leaf or something error
 
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to npm.forge.doodle.com/repository/doodleclient/@doodleclient/… failed, reason: unable to get local issuer certificate
yep ^^
 
10:22 AM
fyi, there is a better workaround for that strict-ssl flag
npm config set registry http://registry.npmjs.org/
not sure if you still cna use now. I have used that when installing npm on a device behind a proxy
 
hello
 
@itsbinz 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.
 
ok
 
@itsbinz 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
@itsbinz 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
 
npm config set registry http://registry.npmjs.org/
@KarelG yeah I have this set and it works for installing all the public npm packages
 
10:26 AM
1 message moved to Trash can
 
but doesn't work for installing this private one
 
@itsbinz 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
 
 let y = 0;
 for (let x = 0; x < 20; x++)
 {
   if (x%2 === 0)
   {
        y += 3;

    }
    else
    {
         y -= 1;
     }
   }
Please help with the output of y. I have got as 24. But i dont know it is correct or not
 
10:28 AM
run it?
 
I am new to javascript
 
press F12, go to "console" tab, copy over that code, paste it, execute the code and then check y by just "y"
 
where
 
just here, when you are in the browser. F12 opens the console, unless you're on mac based browser
the shortcut for that is something I don't know
 
How to execute in console?
 
10:30 AM
press enter?
 
20 is displayed
 
write 1+1 then press enter
 
20 is the output of y?
 
@itsbinz well, that's your y
yes
you can verify it by just y in the console and press enter
it will display the value it holds
 
Thank you so much
 
10:32 AM
sadly, your guess isn't correct. But that can happen. Learn from it why you made a mistake.
use pen and paper since you have to go to 20 19
 
yes
Thankyou
 
11:18 AM
Yooo!
Learner is back to learning
How can I add line break in javascript string
 
Anyone here good with Vue.js?
 
@learner Like a line break? \n or \r\n would work. The former is Unix style, the latter Windows. If you don't really care, you can just use \n - all tools that are worth using will recognise it as a line ending regardless of platform.
 
Like this alert('Hello' and then world in another line)
 
Anyone knows, how to pass parametres to built single-file-component? By built I mean built with webpack into bundled JS file.
styles, images, template and js code inside one *.js file, wrapped in webpack method.
How to pass props into THAT? ;p
 
Thanks @Vlaz.
 
11:55 AM
should be said that a line break in html code means nothing at least for what concerns the visualization of said text on the page
 
12:11 PM
Okay, can anyone settle this for me:From a hierarchy standpoint in a situation where a container has a child that is used like a "title", which is the correct/common order
heading -> header
header -> heading
Or would it be more like: [header/heading] -> title
 
why would there be an order?
I would just call it a header
or a title is fine as well
 
it was for naming convention purposes. I went with title as well where header is the parent container
 
meh, I just don't name things that don't need naming
aside for styling, you probably don't have a need to specifically target the text as opposed to the header container and vice versa
ideally you'd just give it a class and that's all
 
fair point as I'm pretty sure I am over complicating this entire thing
well I'm creating everything dynamically, and depending on the object the parent "header" has a different className
 
hmm, well I see nothing wrong with "titleContainer"
header mixed with title would seem to imply they're separate concepts
 
12:23 PM
oh I do like that better. just like you said, it shows the relationship between the two elements while maintaining readability. Thanks @Neil!
 
no sweat :)
 
12:37 PM
Thanks for suggestion about input maskes @KarelG and @Ben Fortune .I've found the answer.
 
12:48 PM
eh; it's Ben that should get all the credits
he came with the right term while I was trying to figure out that one.
it was kinda on the tip of my tongue
 
 
2 hours later…
2:19 PM
hi good people
hi
so what I am saying is that I have a an object like this
export class anotherThing {
    thing1: 'hello';
    thing2: 'world';
}

sampleObje = {
    something: 'here',
    something2: anotherThing
}

// prints out like this

{
    something: 'here',
    something2: anotherThing {
        thing1: 'hello',
        thing2: 'world'
    }
}
 
user11867329
2:35 PM
wassa de izzu?
 
please use a somewhat more correct English ...
@ChristianMatthew yeah, that's the .toString result. That's not how you import something.
look for import syntax
 
3:14 PM
hmmm?
this is typescript
 
🚽
 
what can I do to get rid of that
it's not a string btw
 
git rid of what
 
the class title of the object
none other of my objects are that way
 
You want something more like:
{
      something:  'here',
      thing1: 'hello',
      thing2: 'world'
}
 
3:39 PM
here is the object so far
 { user_locale:
   { city: 'Miami',
     zipCode: '11111',
     freeFormAddress: 'Miami, FL 1111' },
  user_person: 'myself',
  user_sex: 'male',
  user_age: '51',
  user_symptoms:
   UserCovid19Symptoms {
     fever:
      { name: 'Fever',
        text_description: [Array],
        temperature: [Object],
        fever_grade: 'intermediate_grade' },
     chest_pain: { name: 'Chest Pain', text_description: [Array] } } }
the problem is the UserCovid19Stymptoms
why is that there lol
it may not even be a problem
 
because that's the name of the class I assume
 
a class isn't an object
turn it into an object and it should work fine
 
oooh you're getting freaky with me.... telling me to objectify it
jk
 
hah
 
3:44 PM
lol
so it is an object in functionality but that name hmmm let me see
const classToObject = theClass => {
  const originalClass = theClass || {}
  const keys = Object.getOwnPropertyNames(Object.getPrototypeOf(originalClass))
  return keys.reduce((classAsObj, key) => {
    classAsObj[key] = originalClass[key]
    return classAsObj
  }, {})
}
geez all of this code for just that? my god
 
well I mean, if you have no reason to use a class, don't
a class is useful if you'll have potentially many instances of them
 
so instead just an interface?
 
or, you know, an object
 
mmmmm damn it
i'm using it about 5 times
i don't want to unravel all of that everywhere
i do it with fever and that's fine
doesn't do that
ahhh because fever is an interface damn it
 
4:01 PM
well I mean, just make an object and test it with some static values
I think that's the reason at least
make you could make a root object with a function which does that code you posted above to convert it to an object
then make all your other classes derive from that
 
but in reality what's the harm, if I do this... user_symptoms.chest_pain I will get the value
i mean at the end of the day isn't it just an object
or could i just create a class at the end...mmmm i just thought of something
there is kind of an advantage to this.
I won't get undefined in my ending object for any properties that weren't populated
 
 
1 hour later…
5:22 PM
o/ everyone
 
user8729657
 
@OvieTrix please don't spam the chat. my arm gets tired scrolling up so much.
 
user8729657
Sorry!
 
 
How do you initialize a stack data structure in JavaScript?
 
5:30 PM
[]?
 
@Matthew just use an array with push and pop
 
var MinStack = function() {

};
when the function is called, what will make it initialize a stack? new Array()?
 
or []
 
return []?
 
sure
 
5:31 PM
both
 
although if you don't use it v8 will probably optimize it away
 
it's unnecessary to use a function for that
 
hey guys. I want to setup to take an array with an interpolated string sentence and fill in the number of properties in the array. c# has a feature like that but not sure if javascript or typescript does
 
${}
 
yes but can they be conditional?
 
@ChristianMatthew can you please give an example of what you mean? input and output
 
I have an array ['christian', 'pual', 'michael']
there are 3 names that could be 1 to 5 in an instance
I want a sentence to output Hi, Christian, Paul and Michael welcome to the show
 
|| mdn join
 
Hi, ${name1}, ${name2}, and ${name3} welcome to the show. ?
 
5:41 PM
||> ['christian', 'pual', 'michael'].join(", ")
 
@JBis "christian, pual, michael" Logged: ``
 
5:59 PM
yes but what if there are 4 or 5 names
so I have this regex
const regex = /,/g;
 
||> ['christian', 'pual', 'michael','bob','jason'].join(", ")
 
@JBis "christian, pual, michael, bob, jason" Logged: ``
 
5 names
 
and that does the trick but what if I want to do multiple things on the regex for example what if I want to afterwards remove the last ,
 
|| mdn array slice
 
|| mdn array splice
 
pick your choice
 
for the last ,
what is the diff of them
 
huh?
 
6:12 PM
this worked perfectly thanks @JBis
const symptomParser = reportedSymptomsArray.join(', ');
            const regex = /,(?!.*,)/;
            const symptomList = symptomParser.replace(regex, ' and ');
 
terrible
but ok
 
why
lol
it's literally what you said to do
 
unreadable, inefficient
 
mmmm it's effective and the least amount of code
what would have been better? splicing the end of and putting the word and there then tacking onto the end
 
||> function commaAndJoiner(arr){
   const lastEl = arr.pop();
   return `${arr.join(", ")}, and ${lastEl}`
}
commaAndJoiner(['christian', 'pual', 'michael','bob','jason'])
 
6:15 PM
@JBis ReferenceError: arr is not defined Logged: ``
 
well that works in real life
James is just stupid
pop out the last element and then use string literals as @Matthew suggested
 
yep, looks like that should work
 
mmmm ok that is better good one
what if there is only one?
 
do an if statement
 
check that case
 
6:20 PM
what if there are 2?
You have the following symptoms: Chest Pain.
You have the following symptoms: Chest Pain and Shortness of Breath
the flaw i see in that function is that it forces it all to be an array first
here is the output
"christian, pual, michael, bob, and jason"
my way works pretty well and there is not if statements
 
yesterday, by JBis
1. Does it work?
2. Do I know what its doing just by looking at it?
3. Are variables named properly? (Could also contribute to #2)
4. Does it take advantage of language specific features?
5. Does it follow normal industry standard approaches?
6. Is it efficient? (1-5 are priority most of the time)
regex is almost never readable
 
today, CXM
1. Does it work <<< you're way doesn't work
also, this seems pretty popular on stack
653
Q: Fastest method to replace all instances of a character in a string

Anriëtte MyburghWhat is the fastest way to replace all instances of a string/character in a string in JavaScript? A while, a for-loop, a regular expression?

 
@ChristianMatthew with the ifs it would work
@ChristianMatthew yes, but you shouldn't be replacing anything
 
but why? regex is good for many things. by no means should anyone overuse it and it's always a pain to pull out of the shed but it's effective when need be
you can't shy away from tools because they're not always pretty or readable
 
 
1 hour later…
7:52 PM
there's almost always a better way to do it
 
8:08 PM
"There's a way to do it better - find it" ~Thomas Alva Edison
I just had to...
Firebase is kicking my behind right now, shoot.
 
why does everyone love use firebase?
 
i don't
but, i did find it easy to use
and... basically free
 
8:23 PM
Everyone LOVES firebase because its....easy lol
 
But no, really, thats pretty much it, its easy and it pretty much does it all for you
I believe its a great service and it provides alot of other functionality
to be precise, flutter and firebase are kicking my behind, dam functions, doesn't want to add to the array hm! and overwrites data
What in the world is that video...
 
9:10 PM
thats gonna be a game changer
 
9:30 PM
@jbis - Regex is one of my least favorite things to ever work with, including my days with Assembly etc. It triggers an OCD in me for whatever reason lol.
 
9:54 PM
 
 
2 hours later…
11:57 PM
hi everyone
 

« first day (3464 days earlier)      last day (1467 days later) »