« first day (2776 days earlier)      last day (2164 days later) » 

12:11 AM
@Allenph On Mars
 
@ShrekOverflow Duna
 
they should have called it tuna
 
So anyone have scale reccomendations for under 2.5 mg?
 
12:31 AM
@HatterisMad wanna play ?
 
12:51 AM
@zirak did knowing V8 Internals change your perception of JS ?
 
Its funny Android still reminds me of Java on the Treo Windows Phones because it has no notification dots and simply just icons in alphabetical order.
 
1:18 AM
morn y'all!
 
do you actually say morn in real life Tavo?
Is this an Australian thing or someting?
 
1:32 AM
ksp people
 
user2620028
1:43 AM
@ShrekOverflow just got on to play with friends in halo lol
 
3:28 AM
Saw a video from Everyday Astronaut about there being no way Space X can do a second stage recovery. After today's fail to catch the fairings, I was thinking about it...if you could get the second stage into a low parking orbit you might be able to do a hard dock.
Everyday Astronaut seemed to think that it was impossible for the second stage to get back using conventional methods. Was wondering if you guys had ever tried using multiple orbits with an elliptical to aerobrake and then retrothrust or something.
 
user7347625
3:52 AM
hey all!
 
@iviouse 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.
 
@William I do. It's the first thing I do when I get into the office. Also, I'm Spanish :)
 
user7347625
quick ?
 
I say morning to all the secretaries at the entrance, the colleagues I bump into and the people in my team. Every day
 
user7347625
I am tying to use the following function, and it works in chrome, but not IE

if (tempArray.length > 0)
uniqueArray = tempArray.filter((v, i, a) => a.indexOf(v) === i);
 
user7347625
3:56 AM
and no go. doesn't even work
 
user7347625
any ideas?
 
1 message moved to Trash can
@iviouse Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
which IE?
 
user7347625
ok. Trying to use the following filter. It DOES work in chrome but not IE.
 
user7347625
if (tempArray.length > 0)
   uniqueArray = tempArray.filter((v, i, a) => a.indexOf(v) === i);
 
user7347625
4:00 AM
IE 11
 
user7347625
I tried to re-write as:
 
user7347625
if (tempArray.length > 0)
   uniqueArray = tempArray.filter(function (v, i, a) {
      a.indexOf(v) === i;
   });
 
user7347625
but that breaks in both IE and chrome
 
ie 11 should have both filter and indexof so i'm not sure what it could be
do you get an error?
 
user7347625
no errors
 
user7347625
4:04 AM
it runs through that second condition
 
user7347625
no errors
 
user7347625
with the first one I get the following error
 
user7347625
one sec
 
user7347625
SCRIPT1002: Sytax error
File: view.cfm, Line: 2552, Column: 71 which is this line
 
user7347625
uniqueArray = tempArray.filter((v, i, a) => a.indexOf(v) === i);
 
user7347625
4:07 AM
and when I follow the error link I get the following from MS:
You created a statement that violates one or more of the grammatical rules of JavaScript.
 
user7347625
but chrome runs it fine
 
4:30 AM
oh, it's maybe the arrow function
yeah, can't use arrow functions in ie
and you tried to rewrite it, but didn't add the return
you need to do return a.indexOf(v) === i;
 
5:19 AM
@JessieJohnGocotano 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.
 
do tell
 
1 message moved to Trash can
@JessieJohnGocotano Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
ty
w8
var a (b,c) {
    $('#someId').on('click', function () {
        loadPage(initModule)
    })
}
var initModule = function (data) {
    shoModal(data);
}
how do i get data from loadpage?
c contains expected data
 
what is loadpage?
 
loadpage(success) {
    $.ajax({
    ...
    success ....
}
so it requires callback to get data from ajax
 
5:43 AM
yeah, return the promise
then use it
return $.ajax
 
thank you
but well
I only wrapped my code in a function
loadPage(function(data) {
    initModule(data)
})
my bad
 
that's fine
return the promise
then use it.
.done(dostuffwithdata)
 
thanks i just know done method 😂
 
hello?
 
@Snow 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.
 
5:59 AM
@Tavo so you work in spain?
 
6:09 AM
ohhi?
 
what are other ways you think can link a button to another web page? cause i've tried window.location, onclick, ....?
using jquery or js
 
"use strict";
var info = [];

function myFormData(event){
event.preventDefault();
var uName = $("#uName").val();

var userObject = {
uName: uName,
};

for(var i=0; i < info.length; i++){
if(info[i].uName.toUpperCase().trim() == uName.toUpperCase().trim()){
alert("Username: "+ "" + $("#uName").val() +" is already existing");
return;//EXIT
}
}

addinfo(userObject);
console.log(info);
alert( "Username: " + "" + $("#uName").val()+ " Is Now Registered" );
}

function addinfo(userObject) {
info.push(userObject);
Helo guys
 
@Snow what do you mean with "link a button to another web page"
 
uhm how do you separate $(button).attr("data-index", index).click(removeData); in the function redrawList(). I want to separate the function of deleting object in the function redrawList
 
clicking on it = go to that another webpage?
 
6:15 AM
@Karel
@KarelG what i meant by that was by clicking a button it proceeds to another screen
 
> proceeds to another screen
 
@MadaraUchiha This is the correct answer actually
 
what do you mean with that? Second screen? Another tab window? another browser window ?
 
just another screen with the page, no tabs or other window
*with in the page
 
hello guys i have a concern, i wish that you saw my code. uhm how do you separate $(button).attr("data-index", index).click(removeData); in the function redrawList(). I want to separate the function of deleting object in the function redrawList. In redrawList the only codes there will be the displaying the data. Thanks.
 
6:37 AM
you can delete the line?
@Snow do you mean "scroll to" a view on another location?
 
no not that one, anyways i've solved my problem hehehe
$("#SomethingEmpNo").val() % 1 == 0
what does it mean? ^
 
6:53 AM
It checks the value can be converted to an integer (or the empty string)
i.e it's not "something" or "3.3"
 
Hello
Any body here ?
 
can you help me plz in simple issues ?
 
did you read the room rules?
 
7:04 AM
you'll find your answer there
 
thank you for help
really thank yo
 
Seriously. We get your sarcasm but really reading the rules would alleviate your pain...
 
!!welcome husamalmasri
 
@husamalmasri 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.
 
maybe kendall should have made the question sentence in bold
adding clarity
 
7:12 AM
Gas Station Employee: I'm picking up your sarcasm.
Richard Hayden: Well, I should hope so, because I'm laying it on pretty thick.
 
Do you know where you can find the sarcasm in your message?
 
@CapricaSix than you Caprica ... My question here stackoverflow.com/questions/50466825/…
 
@husamalmasri its been closed as duplicate... are you saying its not?
 
7:27 AM
@SurajRao yes read my question
 
you asked the same question twice and the original one got closed as a duplicate.
 
do you guys see any problems in this code when It is used as a error handler instead of request-promise? pastebin.com/6GFhYM60
 
@husamalmasri Not a good way to ask
 
are you talking about me sir
 
@PhillipYS no sorry.. was addressing someone else.
 
7:31 AM
@PhillipYS you are waiting on an async function (so making it sync). That should not throw exceptions
so the try catch voodoo is useless
 
@KarelG but would it make the function doesn't work as expected?
 
it would work but not as you may expect
 
@SurajRao plz if you can help me answer to my question ... I am feeling there is very small change to run my code in Correct format
 
if you want to handle errors in promises, use the reject feature
 
@KarelG but we have (async/await) and (try/catch), I don't think there's any point on using reject feature when I'm not using raw promise feature
 
7:40 AM
you are mixing both. I advise to not do that
you can use try catch within promises, but the return should be a reject if needed
not expecting an async function throwing errors
 
huh, we have try { await something(); ... } catch (err) { ... } all the time in our code
I thought it was standard for async/await
which is part of the reason I dislike async/await
 
look, you dislike it already
the only reason to do that is to catch errors with the value from an async function
like
 
but I don't get it. Are you saying we shouldn't try-catch things that might reject?
try catch is so ugly :/
 
say that to a 12-year java veteran
 
s/j/old j/
 
7:47 AM
try {
  const foo = await bar(tinkyWinky, dipsy, laalaa, po);
  // do something with foo -> may lead to error
}
catch( ... ) {
  // handle problems when working with foo
}
but if there are no cases for exceptions when handling foo
then there is no need to wrap it
 
how about the node apis?
promisify purposefully rejects when there's an error
so I thought that's how promises are intended to look like
let something;

try {
  something = await someNodeApi();
} catch (err) {
  logger.error(err);
  something = someDummyThing;
}

// do something with something
this is a common pattern in this codebase
 
probably there is a person that start to handle it by this way
a colleague took it over
they both started to "correct" the code base
everyone adopted on that kind of "pattern" and kept using it
 
so you're saying that util.promisify creates bad patterns, in a way?
I'd disagree. But my solution would be to use raw promises instead of async/await
so maybe they're bad patterns for async/await
 
I have seen people writing async functions where the body was completely synchronous without await keywords
did not made any sense whatsoever ...
 
from your point of view, promises shouldn't fail on purpose, right?
 
7:57 AM
hi
 
\o
 
@towc why is there a reject feature?
 
@KarelG so you can let it fail on purpose
 
see.
why try catch then?
 
wait a sec. I'm talking about a rejection in the awaited promise
which would trigger the try/catch
I assume you were talking about a promise that would wrap around that try/catch?
 
8:09 AM
@towc @KarelG it's the exact same discussion about throwing Errors
There's usually little reason to throw your own errors
It's often an indicative of using Exceptions as flow controls, and that's generally a bad idea
But there are cases where it's OK
Same goes for Promise rejections.
 
the main reason we use them is to handle database queries and similar
the sdk that services like couchbase provide tend to throw errors
 
Well, it may be similar but async function should not throw exceptions. That is unnatural IMHO
 
so we use those and pass them along when needed. Which might not be the best thing to do, sure
 
@towc that is because of the bad approach they are using
 
@KarelG Why?
What if there's an exceptional situation?
What if you had disk failure? What if the database connection got terminated midway?
Saying "it should never throw" is naive
 
8:13 AM
then you have to handle it in the function that handles the disk operation
there you can use try catch
 
well, these ones throw a bit too much. I do think it's a bad approach
and we could abstract it at that level, but meh
 
Hey guys, anyone using jest, or any other testing framework with react? Racking my brains trying to figure out if there's a way to have a redux store mocked for every test (without having to add it to each test)
Also, been a while (for those of you that remember me, lol) o/
 
I also gave an example where you can use try catch but ...
 
@KarelG actually you (in particular)'d probably want:
const foo = await bar(tinkyWinky, dipsy, laalaa, po);
try {
  // do something with foo -> may lead to error
}
catch( ... ) {
  // handle problems when working with foo
}
by your reasoning
 
that is what I do :P
 
8:15 AM
why?
 
@KarelG But you don't know what to do at that point
 
makes debugging easier because I only have to find and replace the catch with console . log stuff
 
Imagine you're implementing fs.readFileAsync
 
why is raising an exception in async code worse than raising an exception in sync code ?
 
You're the one opening the file pointer and reading the file to a buffer
Do you know what your consumer wants to do in case there's an error?
Maybe they want to retry, maybe they want to log, and maybe they want to blow everything up and raise alarm bells
You can't know, you're too low-level
 
8:17 AM
The goal of async/await is to make async code look like sync code. I don't see any reason to add a difference in exception logic
 
This is why exceptions travel up the call stack, yes, even async calls stacks.
I'm not a huge fan of exceptions as a concept, mind you, but this is a main feature that you shouldn't cast aside.
 
I've still not decided whether I like exceptions or not (I sure dislike the way they transform java applications into minefields but this could be avoided without throwing away exceptions).
 
@DenysSéguret That's not why I hate Exceptions
Also, what turns Java applications into a minefield is null, not Exceptions
 
@MadaraUchiha fs.readFile has a callback argument that accepts err handling as second arg AFAIK
 
@MadaraUchiha both... and heritage... and most of java
 
8:20 AM
I dislike Exceptions, because you unwind the call stack, and can't rewind
@KarelG Right but I said you're implementing fs.readFileAsync, which returns Promise<Buffer>
 
or you just use fs.promise
 
Note, you aren't using fs.readFileAsync, you're the one implementing it
 
ya know, there is a .catch in Promise
 
@DenysSéguret If I want to make a high level decision, I'm now stuck back in high level code, without the ability to resume my normal execution if I choose a strategy to recover
@KarelG Again
You aren't using fs.readFileAsync
You're writing it
 
Yes, I throw an error here. But that is completely different discussion
 
8:22 AM
@KarelG How so?
 
there is throwing at the lowest layer (on top of IO) and doing that somewhere in an API that responds to external calls.
if an api function fails due of internal error, reject it with concise errors
hmm need to reload page
 
14 mins ago, by Madara Uchiha
There's usually little reason to throw your own errors
I did say that
Just that saying something like "never throw" is a bit too wide to be considered helpful :)
There are cases where you want to throw
Most of them aren't valid cases though
 
I did not say I never use it. Only that is used very ... incorrectly. Hence this leads to lots of try catch around await myAsyncFunction
which I dislike
 
mornings
 
hola
 
8:33 AM
hola!
como estas?
 
8:47 AM
@ndugger, buddy, if someone comes in here and asks a question, and you lose patience, just walk away. Either be nice and professional about it, or just move on. It's not cool to attack new users, even if you think they're extra dense.
 
are you talking about that jQuery talk where some people tried to troll the chat or something that happened later ?
 
Hello guys, I hope all of you are doing fine. I have a js file which I want to minify which can be done by writing a gulp task. The thing that I was wondering about was how can I export a function (readable by humans) so that any person using my file can use that function to initialize some of the things in that js file like the full calendar library. Full calendar whole file is minified except the full calendar function which can be used to initialize the full calendar
 
@Gardezi 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.
 
meh, nick was cool there imo
until hellzone came (who keeps shittalking in an unfunny way all the time)
I'd get frustrated
although I would probably just kick hellzone
 
If people try to troll the chat, kick them
Or ignore them
Don't get baited into saying something that would get you flagged and banned
 
8:53 AM
there was no RO being active back then
But nick really trapped in the troll trap
he could have avoided that.
 
why, what were they saying?
 
@Gardezi Most minifiers would know not to mangle names of global functions.
 
now I'm curious as to whether or not I would have gotten trolled myself
 
@MadaraUchiha if you could share some article that could help me with this that would be great
 
8:55 AM
// A
something.reduce(
  (newSomething, [key, newKey]) =>
    Object.assign(newSomething, { [newKey]: otherSomething[key] }),
    {},
);
// or B
something.reduce(
  (newSomething, [key, newKey]) => {
      newSomething[newKey] = otherSomething[key];
      return newSomething;
    },
    {},
);
// or C
something.reduce(
  (newSomething, [key, newKey]) =>
    (newSomething[newKey] = otherSomething, newSomething),
    {},
);
 
@Gardezi There's really nothing to share,
If you make your function globally available, the minifier will skip it
 
I like A because it's elegant, I'm asked doing B because no useless object creations, but C is somewhere in between, although it's confusing
 
@towc something.reduce((res, [key, newKey]) => ({...res, [newKey]: otherSomething[key] }), {})
 
@MadaraUchiha that's even less object-efficient
 
Don't try to preemptively optimize in a self-optimizing system like v8.
 
8:57 AM
but it's much more elegant
 
Neil, keep in mind that nduggers' comment that got flagged got removed from the chat. So you cannot see hwat he said
 
ah, well he clearly seemed.. irked
 
what is a self-optimizing system?
and how it works?
 
he must have been having a bad day
 
user6086034
yeah.. he was very grumpy yesterday
 
9:00 AM
he got hammered?
 
banhammered or just hammered?
 
the first
cause we're very sensitive with flags nowadays
 
9:31 AM
I must be going crazy, but I could swear I had a comment here...
... Complimenting the user for using a formula instead of a loop -.-
 
so many poor answers
 
Yeap.
Looks like more answers had comments removed, there.
 
could be
 
@Cerbrus and you added it again
 
Yeap. It's not rude, noisy or spammy...
 
9:42 AM
I'm honestly surprised how many answers don't attempt to avoid loops
If I had to write a method like that, first thing I'd think is if it is possible to avoid loops, or nested loops
 
And some of them even have duplicate loops, depending on which of the 2 numbers is larger
 
do u even loop
 
Hi all
 
yeah, the duplicate loop thing.. why..
Math.abs Math.max/min is a thing
 
mornin
 
9:47 AM
Can anyone tell me in semantic UI and bootsrap, which one is good, I have read some articles on Semantic vs Bootstrap, But I was wondering if any one have hands full experience on both frameworks and they can tell me which one is good
 
I was wondering, that is there a difference between:
function abc(a){ return a;}
and
let abc = (a) => {return a;}
 
technically seen, both are same
 
@mega6382 one lets you call abc later as well
 
I'm using semantic, and the project I'm working on a very big project,
 
oh, nvm
 
9:49 AM
you can say that the arrow syntax is a syntactic sugar for a function.
 
@KarelG that's false
 
Surely, in the 2nd case you can override abc later on, but I don't think there is any other difference.
 
so I was wondering what will happen when I got stuck with something which semantic cannot provide
 
we already had a discussion about that
 
if you assign it to a variable like that, you can't use abc prior
 
9:50 AM
I can't remember why, but it seems that arrow functions are not 100% syntactic sugar
 
assuming that is global scope
 
@mega6382 stackoverflow.com/questions/34361379/… is this what you are looking for?
 
@Neoares Arrow functions don't have their own scope
or something along those lines
 
and there is no arguments + super (classes) and another thing. IIRC 4 things difference
but a plain it is a sugar
Oct 30 '17 at 14:55, by ssube
@SterlingArcher it's sugar, but saying they're the same isn't right
 
the thing is... if you're not a JS pro, take arrow functions as syntactic sugar
 
9:55 AM
No, the this difference is quite significant.
 
what is this?
baby don't scope me
 
in PHP, Apr 25 at 16:38, by Paul Crovella
you js people never know what this is
 
that was fast
 
how to validate drop down in reactive form angular 5
 
@Animay 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.
 
10:14 AM
@Animay that's how you search on google
question to the regulars: is LMGTFY an "aggressive" thing now?
 
@Neoares Do you feel lucky? Well do ya, punk?
 
wat
 
sigh.. kids these days
 
do you not remember
the forever great I'm feeling lucky?
 
I never clicked it
I never felt lucky, I guess
what did it do?
oh, it's still there
oh, it brings you to random sites based on the search term
 
10:27 AM
@KamilSolecki yes
but what does that have to do with what I said
also, it is still implemented
 
it was a joke that Neil made on googling... eh nvm
 
10:43 AM
@Neoares "Do you feel lucky?" => "Do you really want to chance it?"
Explaining a joke is a bit like dissecting a frog. It tends to die in the process.
 
@Neil all the frogs I've dissected have stayed alive and I got them back to a pond safely. What did you do with yours? 0.o
 
did not have to do "frog dissection" during my high school project
 
@towc Necromancy? I respect that
 
@KarelG well, me neither, but that doesn't make me wrong
I have some code like this:
const anotherThing = async () => {
  try {
    return await aThing();
  } catch (err) {
    // react to err
    return await anotherThing();
  }
}
eslint is complaining about the second await, with no-return-await
and fair enough
but it's not complaining about the first one
and I'm confused
 
resisting myself to comment
😀
 
10:50 AM
😀
 
I don't get it :/
halp
 
It's probably a bug. Report it.
 
I'm not falling for that
I remember benjamin mentioned something similar to this a while ago
and he also refused to explain why
so I assume it's really obvious
but I still don't see it
well, they're only not linted in try clauses apparently?
@KarelG please do
 
@KamilSolecki he linked the wrong comment then
 
oh wait, not about the fact that I'm using async/await with try/catch
 
10:58 AM
he linked my question to regulars
 
.
 

« first day (2776 days earlier)      last day (2164 days later) »