« first day (2425 days earlier)      last day (2748 days later) » 

09:00
you're cruel if you generalize us as cruel, just only because madara said that
hello
in javascript alert function could I display a php web page?
@Sheepy Yes, I am a human.
@JavaFan no
var expected = ['b', 'r', 'o', 'k', 'e', 'n'], actual = 'broken'.split(''), output;
function assertArraysEqual(actual, expected, testName) {
   const pass = actual.every( (e,i) => e === expected[i] );
   console.log( pass ? 'passed' : `FAILED [${testName}] Expected ${expected}, but got ${actual}` );
   return pass;
}
console.log( output = assertArraysEqual(actual, expected, 'splits string into array of characters') );
@amarghodke See above
:37481555 Sorry I didn't read that but I updated the code in the last seconds so that it can correctly say pass or fail.
@Sheepy : can you make this in es5 ? const pass = actual.every( (e,i) => e === expected[i] );
09:10
@amarghodke Yes but your original code wasn't ES5. That line translates to var pass = actual.every( function(e,i){ return e === expected[i]; } ); // With shim for every()
@amarghodke Yes, but that isn't a complete answer
!!> var actual = [1,2,3], expected = [1,2,3,4]; actual.every( (e,i) => e === expected[i] );
@MadaraUchiha true
@MadaraUchiha my code had a .length check
You should probably also check that their .lengths are equal
Fun trivia question, make my code fail.
09:12
@BenjaminGruenbaum You posted code?
1 hour ago, by Benjamin Gruenbaum
@KarelG so a.length === b.length && a.every((x, i) => x === b[i]) ?
Find a case it fails for
@BenjaminGruenbaum var a = {every() { muahahaha(); }}
With two arrays...
09:14
i also checked that if i use filter over every it also passed.
I can probably do some funky stuff by messing with getters/setters, but I'm guessing you aren't talking about that
@MadaraUchiha to me ?
3
!!>let a = [NaN], b = [NaN]; a.length === b.length && a.every((x, i) => x === b[i])
@BenFortune false
@BenFortune nice! Now break this:
a.length === b.length && a.every((x, i) => Object.is(x, b[i]))
09:16
@BenjaminGruenbaum "ReferenceError: a is not defined"
Hi, I have a small question
@Lesleyvdp Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
@Lesleyvdp ʰᵉʳᵉ'ˢ ᵃ ˢᵐᵃˡˡ ᵃⁿˢʷᵉʳ
!!> let a = [], b = []; a.length === b.length && a.every((x, i) => Object.is(x, b[i]))
@BenFortune false
09:18
@BenjaminGruenbaum Easy: Run it in IE11.
@MadaraUchiha on spec compliant JavaScript
When I use import in my code, it says import declarations are not supported by current javascript version. How could I import a module with my version?
@BenFortune those are two different arrays though :P
Or just use an empty array
@BenFortune true
09:19
That's still true
Shouldn't that be false?
@BenjaminGruenbaum [[]] and [[]]
Anybody using storybook?
@MadaraUchiha no, since [] and [] are not equal.
Or is MDN wrong?
09:19
Let me clarify, there is a bug in my code that fails for the task of shallow equality of arrays with Object.is
To hint, there are two arrays that are not shallow equal, but the algorithm returns true for.
It's subtle like all the cases you're bringing, so you're on the right track Ben
@Lesleyvdp a build tool does it - typically a module bundler like webpack
@Sheepy : what is main difference in filter and every ? because both works ..
@amarghodke rtfm
@BenjaminGruenbaum I thank you kindly!
@Lesleyvdp sure, I recommend that you start with a boilerplate today - learning how build tool works isn't very easy for a beginner to the web stack.
Definitely worth your time, but not easy.
@amarghodke every() should stops as soon as there is a failure. It's also lighter since it does not need to copy your data.
09:23
@BenjaminGruenbaum Thanks again, I am rather new to javascript. I will look into the webpack that you mentioned
@Sheepy : can i have same explanation for filter as well what it does and when t use ??
@Sheepy : can we use every over filter ??
Hi guys, greetings of the day.

I am creating something in which i need your support.
The idea is to stop execution of code if i click on an element
@amarghodke Try MDN. Sorry my baby just wakes up.
@BenjaminGruenbaum Object.is checks if two elements are the same object. That's different than checking if two elements are equal
That is so Java
09:26
Object.is([], []) should return false IIRC
@KarelG no it doesn't.
o.O
[] === [] returns false too
!!> Object.is([], [])
@Shrek false
09:27
It does the same thing as === minus NaN and some minor handling differences for plus and negative 0
Object.is(-0, 0) is false since 1/-0 is negative infinity but 1/0 is infinity
> Object.is() determines whether two values are the same value.
keh
I have n textarea in which when i hit enter the ajax request start doing its work
before it i am showing a loading.
But before ajax and after loading i want to place something in which if user clicks on the loading the further code(which is ajax request ) should not proceed.
let me know if needs more clearification
dat polyfill of Object.is
@PraveenKumar kinda like canceling ajax ?
Example COde

$("#good").keypress(function(e) {
				if(e.which == 13)
				{
					$("#loading_deskmoz").show();
					e.preventDefault();
					// $("#seconds_deskmoz").val()
					show_loading();//starts to load for 4 seconds
					//the code if a user clicks on #loading between these 4 seconds setTimeout should not execute.
					setTimeout(function(){
						ajax_Request();//Ajax to be axecuted
					},4000);
				}
			});
Looking for an interesting batch script for learning
09:32
@KarelG Yes please read this code you will get an idea
Hey everyone :)
Should I make this hotbar an angular directive or component?
!!tell PraveenKumar mdn XMLHttpRequest.abort()
@PraveenKumar Something went on fire; status 403
...
XMLHttpRequest.abort() <--- jquery has it too
@CapricaSix Fail
09:36
@KarelG you mean this will do the job

$("#loading").click(function(){
    XMLHttpRequest.abort()
});
You must be new in programming?
Also The XMLHttpRequest.abort() method aborts the request if it has already been sent.
My request is not yet sent it will be sent after 4 seonds complete
store the xhr instance in a variable. Then abort it if it's active
you can cancel a timeout too ...
search for window.clearTimeout(...)
atlast I just finish my app and now can edit :))
09:41
@KarelG i have tried that
Stored settimeout in a variable and on click of loading tried to cancel it but i didn't work
@RexAdrivan The first 90 percent of the code accounts for the first 90 percent of the development time. The remaining 10 percent of the code accounts for the other 90 percent of the development time.
@Neil yes :D
it's cool now.. but obviously have so many security issues
@Neil That makes... 100% code in 180% code time?
who want's to join me code the app?
fully javascript (y)
and ofcourse open source!
09:56
@Grzegorz yeah, that's the joke. ;)
@PraveenKumar cus the timeout has already elapsed ...
@Neil Not rly... if you get project estimations into account, then you make 90% of the code in 90% of time.... then rest of code which should take 10% time also takes 90% time. Haha :D
Hofstadter's Law: It always takes longer than you expect, even when you take into consideration Hofstadter's Law
@Neil that's a joke?
oh
haha
@Grzegorz well it should be 50% of the time though right?
The 90% just makes you think that the rest will take 10%
10:02
@Neil Who knows. it never works as expected :P That's why people use "magic time modifiers" :P
@Neil it makes me think, but it does not always happen. all things you don't take into account can make it 180% time of estimated time ;P
> Study suggests women who choose to take maternity leave are seen as inferior employees, while women who choose not to take maternity leave are seen as bad mothers and undesirable partners
@Grzegorz I suppose if 100% represents estimated time and not actual time
@littlepootis you can never satisfy people ;P
@Neil exactly :)
@KarelG Did it thanks for your help :)
italian exam over
everyone's probably still in there
they're going to start sweating in about 30 mins
and a lot are going to start crying in 45
10:18
hey @towc supp
hey m8
did you get what you're doing?
@RexAdrivan What is the purpose of this app ?
@PraveenKumar nothing just finding jobs in your area
Ok area means specific distance or citywise ?
city wise also specific distance...
10:21
Okk good idea..
And technologies used ?
just added worldwide show jobs
@PraveenKumar all javascript? and firebase
@RexAdrivan got lots of console errors ...
Good :)
i meant Nodejs or angular or anything else
angular and firebase only.. I'm not sure with firebase.. anyway just making it bcoz it's free
what i mean is free database hosting :))
mongodb is preferable thouh
It is good worked with it a while ago in ionic project limited but ok
10:24
check it it's realtime
Yeah well how do i colaborate ?
just git pull
then run on localhost
Okk one hell of dashboard :D
(y)
yeah.. i'm adding search function for jobs today.. tomorrow will add chat
10:29
Give me link to pull
just send pull request bro
@littlepootis you found @towc's twitter \o/
one day I'll be that narcissistic maybe
there was one piece of poetry by an italian guy which was almost exactly like that
"M'illumino di immenso"
which literally means "I enlighted myself with immensity"
oh wow, that's golden
10:35
@towc check the app bro
adrivanrex.github.io/rxjob/
10:59
how to do use lodash guys?
@AlanJenshen Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
what I stuck the most is object / array manipulation being a front end dev
11:15
!!google lodash
denied
caprica no longer listens to towc
The google command doesn't work anymore
omy dabot vanished
wat's that bro?
user5716144
the 'this'context is freaking me out
11:28
just use prototype?
user5716144
how can i fix that, so the newProp is no longer undefined
user5716144
@RexAdrivan how should i do that in my case. im a little lost here
1 message moved to Trash can
Format your code please.
!!alive
@KarelG That didn't make much sense. Maybe you meant: live
user5716144
11:37
// Base Class
class Product {
	constructor(quantity, color){
		this.quantity = quantity;
		this.color = color;
		this.createCheckout()
	}
	createCheckout(){
		let order = {
			amount: this.quantity,
			color: this.color
		}
	}
}

class MyProduct extends Product {
	constructor(quantity, color, newProp) {
		super(quantity, color)
		this.newProp = newProp;
	}
	createCheckout() {
		let order = {
			amount: this.quantity,
			color: this.color,
			newProp: this.newProp
			console.log(order) // outputs everything correct, but "newProp" is undefined
don't use class
@RexAdrivan Why not?
for honor isn't so amazing as it could be
1 message moved to Trash can
@RexAdrivan Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
simple syntax
got it?
11:45
@RexAdrivan It still doesn't explain why classes are bad in your eyes.
well it's messy
user5716144
well, besides the fact it might be messy for some experienced coders, how could i fix the problem with 'this' in my example?
it could also be messy for unexperienced coders
user5716144
jep, its messy for me aswell. but also is the prototype.. thats why im asking now :)
wasn't talking about you in particular ;)
user5716144
11:52
no offense taken :)
Any of you ever wrote an answer that crossed the SO max limit ? :P
where can I buy rx 580s
they're out of stock everywhere
@Gregor you figured out? :D
call it prototypal inheritance
@Neoares eh, had to look on several hardware sites i'm using
they're out of stock almost everywhere
fucking miners
12:01
I love when online merchants pay me to take more stuff
@KarelG wait you said "almost"
god it is stupid hard to type with one of these on
got a broken wrist again?
it never really got fixed
last few days it's been hurting again, this morning it was bad enough to put on the brace and take an advil
console.log('value', this.value);
const selectedId = this.value;
if (selectedId)
  console.log('in if');
else
  console.log('in else');

// console
value 0
in if
what am i missing?
12:14
curly braces
!!> "0" && console.log('.value is a string m8')
@rlemon "undefined" Logged: ".value is a string m8"
!!> "0" ? 't' : 'f'
@KarelG "t"
aah. thanks
non empty strings are truthy
12:18
yeah, forgot that it (select box) gives a string and not its numeric value. I'm not awake today
yea, just remember. it's all inputs values
even input type="number" returns a string
just how .value works.
user5716144
@RexAdrivan thanks, I know what it's called. And no i did not find out. But thanks for helping out.
Wew, got my house!
@BenFortune \o/
so party at bens?
anyone know about cars wanna tell me is this how they evolve into planes? i.redd.it/xf47kojl6q1z.jpg
12:38
Next level hot box
I want to get grammar in to an array, I tried this: arr.splice((arr.length - 1), 0, "and"); But it doesnt work.
Lets talk AR
What have you tried already ?
@kPieczonka He just told you. Something weird
@OliverSalzburg :/, newbies gonna newb, it looks logical to me
I suggest any one who mentions AR + Geo Tagging should get Facepalm meme
12:44
!!> const arr = []; arr.splice(0,0,'and'); arr;
@rlemon ["and"]
yo problem somewhere else
@Luggage webpack 3 released
12:45
@rlemon Luggage is afk: 💊🍷🛌
How to set breakpoints in Codepen? :P
@RaisingAgent open your dev tools
and write debugger where you want the breakpoint
or, once you're in the dev tools, just set a breakpoint
the source file is hidden in some folders
@ssube It's a tiny bit tricky with iframes
I support the use of debugger statements in this case.
12:48
hi ho
found it
meh, it's not that tricky
Just a wee bit
@ssube how does codepen runs user code?
eval / document script tag?
@CatBoss iframe
12:48
can someone tell me, why my wordsArray doesn't get the translated words assigned?
Like jsfiddle
@CatBoss whatever way will freeze your browser most often
        wordsArray.forEach(function (wordBlock, i) {
            googleTranslate.translate(wordBlock.word + "", 'en', function (err, translation) {
                wordBlock.word = translation.translatedText;
                wordsArray[i].word = translation.translatedText;
                console.log("wordsArray[i].word:", wordsArray[i].word);
                if (i + 1 === wordsArray.length) {
                    res.json(wordsArray);
                }
            })
        })
it's codepen
Only you don't need to hit "save"
12:49
how does it load the code into the iframe?
codepen.io/pen/handleId/pen.js (pen.html, pen.css)
@Suisse You're calling res.json inside a loop
@Suisse Use Promises.
@BenFortune no its waiting when the loop is finished
@Suisse Yes, but async and loops don't mix that way
12:50
.json doesn't implicitly call .end
@rlemon res.json() means its finished, its the end
you might like it to mean that
but res.end means you're done. it's the end.
@MadaraUchiha hm but the loop never gets to the res.json() part ; first when the loop is over
@rlemon It doesn't?
@rlemon, when res.json() is called, the result is given back to the browser - its the end
12:52
like 99%
@Suisse res.send will do the same without a res.end, but it isn't the end
// End the `res` stream.
res.end();
};
I opened the res.json()
and its from the same function like .end()
so res.json() does call .end()
This is the end, my beautiful friend
This is the end, you know. Lady, the plans we had went all wrong.
@Suisse no, .json can call end, but it doesn't promise a .end call
This is strange
12:55
because .json calls .send, and .send doesn't call .end unless it is the end of the stream
you can .send('foo').send('bar').send('thing').end();
hm ok
I never used .end() after .json() - in none of my projects :S
@Suisse Again, use Promises.
you don't have too. my point was multiple calls for .json isn't invalid
because it doesn't end the stream when you call it

« first day (2425 days earlier)      last day (2748 days later) »