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

03:01
@Mosho overleaf.com/9876564bjqmktdsbbjk#/36154948 click on the previw, it'll highlight the latex
shit, i picked a bad example that that
some areas work better than others
sweet, I'll check it out
XPath is weird
it's the best Prolog that XML could come up with
hellloooo guysss
We aren't home.
I assume you get used to it
03:06
@lix simple just obj["nameOfproperty"]
dw friend, I forgot to decode it :-)
I don't understand your statement.
so anyone discovered how to order property name?
XPath and XSLT and all the tools just felt very inside out to me, like Prolog
you ask a question in a very strange way and get some answers
XSLT is certainly weird, but XPath seems straightforward to me… ?
03:09
they both makes sense.
xslt is the transform, right?
yeah
yea, that makes sense. I've written own* in my day for actually work. I'm not saying I LIKE it or that it's pretty, though
@RexAdrivan christ, are you still going on about that?
they make sense, they're just weird
but fairly simple "match this, and use this template to output that data"
03:11
the "match this" can get complicated, like in regex
@Cauterite haha yeah just can't find the answer .
i think we went over it pretty thoroughly yesterday
i found that just make an array like [["key1", "value1"], ["key2", "value2"]]
Object.keys(obj).sort()
^ partial misleading answer
03:12
that would give you a sorted list of property names
doesn't matter in this case since we already discussed such possible solutions at length yesterday
I think the question is about enforcing order in an object or sorting an object's keys (with the values intact) (well, you'd need to make a new object, i think)
oh to ensure order when going through a for...in loop?
Right.
That used to not ever be guaranteed, but i think that is now maybe changing?
reads mdn
03:15
unless the spec says order is maintained, I'd use an array or maintain a separate list of the right order to read keys
reads latest spec
Also, I need to know if IE11, chrome and firefox will respect that spec, so get reading on that, too, please.
20
Q: Does ES6 introduce a well-defined order of enumeration for object properties?

Ben AstonDoes ES6 introduce a well-defined order of enumeration for object properties? var o = { '1': 1, 'a': 2, 'b': 3 } Object.keys(o); // ["1", "a", "b"] - is this ordering guaranteed by ES6? for(let k in o) { console.log(k); } // 1 2 3 - is this ordering guaranteed by ES6?

Why would order matter (except for readability with console.log or json.stringify)?
rhetorical question, mostly..
maybe if you want to hash the JSON
(or just == it)
03:20
Perhaps.
not an especially compelling reason
@Luggage try using loops
I'll try that.
yea, if I wanted a hash of json that was immune to order, i'd deserialize and order it
@Luggage see if you can order the object
just try creating a new object
@RexAdrivan nice try.. tricking me into doing your homework.. :)
03:23
order shouldn't matter, but tons of people wanted it
It's not homework somewhat javascript related issues
okay....mdn says that it orders based on original insertion order
knowing insertion order is useful for queues and paternity tests, but that could have been solved with a simple collection
@ssube indeed
yea, in practice, it seems to keep order. I see that in my console.
But, personally, I wouldn't depend on that since the spec says no.
03:23
my understanding of the spec is that it calls something called Return ? EnumerateObjectProperties(obj).
@Luggage yeah but what about unordered properties
if you want to be backwards compatible, at all, you shouldn't depend on it
and the rules for that are
The mechanics and order of enumerating the properties is not specified but must conform to the rules specified below.
that's not something babel can polyfill :)
though that's only my super vague understanding
03:24
@derp i lol 2018 it's 2017 hehe
maybe where you are
that would explain why you don't know these things yet
it's been 2018 for 14 months now, here.
things are confusing ever since the moon was knocked into a lower orbit by that large santa clause.
bro @Luggage can you send me the function on how you reverse the object?
its tuesday here already
time can do all sorts of funny things, all you have to do is get some good grass and roll it every day for 600 years
03:27
reverse...an object?
const foo = oof;
like that?
Objects don't have order, so: 1. get a list of keys. 2. Sort that list 3. look up each value from the key in THAT list.
maybe }value:key{
should return 1,2,0
03:27
Object.keys(obj).reduce((p, key) => (p[key] = obj[key].reverse(), p), {}) ought to do it
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
@ssube feeder
:37477684 guaranteed random
wait i'll make a pastebin haha
03:29
try to understand ssube's solution first @RexAdrivan
"solution"
@Cauterite value-indexed. nice/
@Cauterite will try
what's the term i am thinking of.. git uses it...
content-addressable
hash-named is so much shorter
1. that's an odd order to desire. 2. You mean to move the keys and NOT the values?
@Luggage yes
seems like more of a permutation than a reversal
but...why?
!!s/a permutation/an obfuscation/
03:32
@derp try loop
@Luggage seems like more of an obfuscation than a reversal (source)
try...loop?
maybe permutation isn't the right word… "rotation" ?
ok just simple reverse the object
i wasn't saying you were wrong, just saying also.. i think it's a mess. :)
03:33
@cauterite invert?
i'm borrowing terms from matrices
@RexAdrivan please use better grammar while vamping
@RexAdrivan in your code are the object keys actually numeric?
@Cauterite it doesnt matter if it's numeric
what matters is the ordering
they'll be man-handled into a string anyway
it does matter, because if they're numeric you would just use an array
and simply swizzle it
03:35
JS almost has swizzles now, with destructuring
ok it's not numeric..
right, so, i think this is what you want to do:
1. Object.entries(obj) to get a list of [key,value] pairs,
2. sort that list by the keys (you'll need to write you own comparison function),
3. swizzle the list (move the last element to the front)
@Cauterite answer in javascript language?
@RexAdrivan write it yourself
that's your job, you're a programming
03:38
stop asking other people to do it for you
that's not welcome here
rex = Object.keys(obj).reverse();
translating english to code is your job rex
tried this but it's not useful
rex, are you a programmer?
how about taking a second to read and understand the steps i just listed?
03:39
yah check my proj adrivanrex.github.io/rxjob/
@RexAdrivan You've been given myriad solutions, links to documentation, and every other resource available. If you choose not to follow up on those, you also need to stop asking the same question(s) here.
@rex you have errors in the console
@Mosho sorry for getting so pissy earlier
np :P
sorry about being a dick
no that's a lie
:>
still got that headache?
I never really had a headache. I was just tired of having sex with you.
always with the hands
03:44
mouth stuff? mouth stuff.
I thought fidget cubes are for practicing foreplay
@Mosho rock climbing. You need that grip strength.
bowling.
@rlemon I think I'd rather go out with an Alien
03:47
Ok guys this is the answer! jstips.co/en/javascript/…
lolol
just figured out today dam javascript objs :))
well, map is different than normal objects. you'll have to use .get() and .set()
But you are right that the order you insert keys is kept for a loop.
yes because the old objects dont use ordering..
and when you loop over a Map it gives you a sequence of `[key,value]` pairs
no different from keeping them in an array
bcoz objects really dont have ordering..
so you have to put it in array
I've been doing this for almost a decade and I've never needed my object keys to be ordered...
03:55
a little destructuring will improve that
@david given you have a json database..
like e.g firebase
@RexAdrivan please, try and make a case for that
@david yea, it's almost certainly an XY problem
@ssube it's already solved..
how does key order help in a json database?
03:56
it is when you are looping on a json object
and you want it to loop in reverse order
is it? explain
there is no "reverse order" if there is no order
there's order if you use array :D
so probably json is not a good format :))
arrays can be stored in json...
your json database probably doesn't store the data in json
believe it or not, JSON supports arrays
03:58
rex, i'm starting to suspect you might not know what you're doing
3
@david you are a bit slow yourself, it seems :)
I mean not use the common json format
what other json format are you using, then?
@ssube i just mentioned earlier use array instead of json
I like to use java instead of script
03:59
Read the room title, please.
\o hello all
it's probably just an update in javascript
not the end of javascript lol
the fact your sentences don't form thoughts almost upsets me more than the thoughts you intend inevitably being wrong
there is a language barrier, too
04:01
unlike PHP it died.. hehe
nevermind
@Luggage I suspected that, but tbh, I think the age difference is more of a factor
!!afk 💊🍷🛌
does font have no effect on how emojis are rendered?
depends on your platform.
A K
A K
04:07
anyone used graphql with express?
iirc, most of them omit the emoji characters from the main text fonts, then have a font just for those
i see
it takes advantage of how font families work
i didn't know font-fallback applied on a per-character basis
I'm not sure it does. It might just be for the whole unicode category.
or specific to the emoji ranges
04:11
I know nothing about JavaScript ='(
@ThiagoLeonel 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.
acceptance is the first step to learning :)
i accept that it's crap
and i accept that it's still a better option than most of the alternatives
JS isn't crap. It has chunks, especially the older stuff, that is.
04:13
kinda like democracy
The prototypical inheritance and function scoping, for example.
Everything about this.
If you treat it as a sensible, modern, semi-functional language and use the same patterns, you end up with much nicer and generally much more stable code.
not to mention the lack of a module system until recently
Oddly enough, none of that really relies on the bad old parts of the language.
I dont mind prototypical stuff. It got wierd when they tried to mesh traditional class based stuff on top off that
Its messhing two different paradigms
it's a poor example of prototypical inheritance and has no value in the language
04:15
JS is certainly a lot better than it used to be, i won't argue with that
and the new class stuff doesn't change the prototypes at all, it's just different syntax
i like es6 classes
same output :)
at least there's a universal way of implementing psudeo OOP now instead of having understand someone else's homebrew
all es6 "classes" do is save you from typing .prototype a bunch
04:16
yeah..
they should have scrapped prototypes entirely and just had real classes, but that's not how JS does
but you still got to know it anyway once you start having to debug stuff
technically yes, but in general, sourcemaps :D
lol the guy only had like 10 days or somethign
me, i'm currently at es8 hahaha
04:17
Gretts from Brazil, I'm leaving now
I'm understanding nothing
\o
@Psudohuman 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 is this, a revolving door?
i wish they didn't remove let expressions :(
04:35
where would be a good place to update browser's local storage in a redux app? Is it in the reducer? Or component?
@Cauterite they didn't, at least not practically: jsfiddle.net/tcqseubL
because let became a block scoped variable, you no longer need let on the expression. It moved to the variable
otherwise not all {} blocks would have behaved the same, and that's one thing they are working to fix
those are statements, not expressions
they work in essentially the same way
the syntax is fairly different
but the idea with let blocks and in and with have, all along, been block scoping. So they cut to the chase.
it's not about scoping, it's about having nice syntax,
@deostroll, i'm new to this but that sounds like a case for redux middleware
04:40
blocks with let variables are more consistent syntax
let blocks would not have played well with destructuring
(let (…) …) vs. (() => {let …; return …;})()
so updating the browser's local storage will be a side effect of some action
@Cauterite let blocks aren't equivalent to a lambda with return
we're not talking about blocks
we're talking about expressions
oh, the second section
that doesn't look like code
it's like do expression proposal
04:43
well it's a terrible example, but all i could find since they deleted most of it from the website
you'd be hard pressed to find a good example of inline variable declaration
other languages do it all the time
yep, it's kind of a problem in many.
Ruby's parser suffers from the stuff you can jam inline, making some reasonable statements ambiguous.
It doesn't really make sense in a language that depends on consistent shapes the way JS does.
well i don't know ruby
i was thinking more along the lines of Scheme or Clojure
haskell probably has it too
I would bet some money that any language that appears to have do expressions and they seem to work well, they're limited to something that can be optimized away or inlined somehow.
04:47
This is a simple example where i change the text every 1.5 seconds and the logic is inside the componentDidMount. Is this the right place for handling the translation between the DOM event and the state?

The alternative is to put the actual ticks into the state but then that would pollute the state with stuff which doens't actually change the view.

Thoughts?

https://codepen.io/anon/pen/GEgeBd?editors=0011
languages that let you conditionally screw with scope and such, outside of Perl (which is magic) and Lua (which is better magic), tend to be horribly broken (like Ruby)
the way JS allows this to change is tangentially related and a huge problem
now i feel like we're talking about different things again
i'm still just thinking about let-expressions
yeah. Perl and Lua take that to different extremes, letting you mess with more/other things than just the variables that are in scope.
@derp I thought middlewares were for async stuff and stuff... :|
The others you mentioned are all functional, so some inline variable is probably constant and probably gets optimized out.
04:50
good
05:00
morning room
@ssube Don't get me started on the magic of Ruby (and the meta foundations of rails)
using ruby without rails is like trying to steer a motorbike without holding the handlebars
@monners oh, it's garbage
magic is the worst, ban the wizards
Lua is just as cool but does it well
i don't remember there being anything unusual about variable scopes in lua
unless it was different in 5.1 (i used 5.2/5.3)
05:17
@BadgerCat did you learn german?
@suraj Welcome to Australia
nah.. Am in India
Oh, I read that wrong
06:06
Does anyone know how to prevent a user from going to the previous page after logging in? Example of this case with this plunker: plnkr.co/edit/j69yu9cSIQRL2GJZFCd1
Use test and test for login, press enter and then go back one page
it shouldn't allow it to go back to the login again if the login is already completed
I'm using Angular 4+ but the plunker angular 2 example uses the same logic
Also the backstack control has never been implemented, so that's not an option: github.com/NativeScript/nativescript-angular/issues/284
Do I have to create a canActivate service just for the login page?
Yep that's the right way to do it
06:34
Hey guys, any tips on this? stackoverflow.com/questions/44377033/…
@phenomnomnominal alright, thanks for the help!
@BadgerCat everything for a better future 🙂
07:20
i want to console.log passed but without JSON.stringify(), Array.join(), or any other right now it is returning Failed  part
var expected = ['b', 'r', 'o', 'k', 'e', 'n'];
var actual = 'broken'.split('');
function assertArraysEqual(actual, expected, testName) {
  if(actual === expected){
    console.log(`passed`);
  }else{
    console.log(`FAILED [${testName}] Expected ${expected}, but got ${actual}`);
}
}
var output =assertArraysEqual(actual, expected, 'splits string into array of characters');
@amarghodke You can't compare arrays in that way.
!!> [1] === [1]
@MadaraUchiha false
Arrays are objects, and objects are compared with object identity, not by comparing elements.
Check the table here
@MadaraUchiha : so i need to iterate for ...in loop ??
07:25
!!> [1] == [1]
@amarghodke Don't use for..in, it's old and practically deprecated.
@suraj false
You can use for..of, or [].filter()
Search both of those
@MadaraUchiha : let me try this...
Hilariously enough, that JavaScript answer (and the rhino book it quotes from) is actually correct. Everything in JavaScript is an object (even primitive values). Strings (and all other primitive values) are immutable, you cannot change a string (or any other primitive value) once it has been declared, but you can create a new string object and assign the reference to that object to the variable which previously held the reference to the original string as its value. — Tiny Giant 8 hours ago
-_-
07:35
all objects are immutable internally
uhm ...
That sort of defeats the purpose doesn't it?
@Tirth just like your sex life
2
:D
07:38
Objects are not immutable, nothing is immutable, only death is certain
lol
Programming is tastefully composing side effects
death also not certain
it came any time
wut ?
it's certain it will come
07:39
^--
o/
@BenjaminGruenbaum that Tiny Giant has a silver badge in javascript and yet he comes with that comment ?
@KarelG @MadaraUchiha had a JS gold badge before he knew JS. I have a JS gold badge and I still don't know JS.
Javascript is sucks
then it must be easy to farm rep there
07:42
if you don't know JS, what the hell am I even doing here?
@Tirth cool
@GNi33 He read the specs and added stuff to Node, he knows JS.
javascript code successfully compile if you write same method implementation :D
htm is basic for java
@MadaraUchiha oh, I'm well aware of that ;)
in the meantime, I'm still just sitting here laughing my ass of about Ghost Story. Thanks for that gem
@GNi33 :)
07:47
@MadaraUchiha : should i compare expected and actual var inside filter ?? i am not much familiar with [].filter
@GNi33 Ghost Story ?
!!> [4, 5, 'foo', 'expected', 'nah', 498].filter(e => e === 'expected');
@KarelG "SyntaxError: missing ] after element list"
@KarelG ["expected"]
@amarghodke ^-- see example
var expected = ['b', 'r', 'o', 'k', 'e', 'n'];
var actual = 'broken'.split('');

function assertArraysEqual(actual, expected, testName) {
return actual.filter(e => e === 'expected');
//   }else{
//     console.log(`FAILED [${testName}] Expected ${expected}, but got ${actual}`);
// }

}
var output =assertArraysEqual(actual, expected, 'splits string into array of characters');
console.log(output);
returns []
@KarelG
07:55
that's a different case ...
there are numerous SO questions of how to compare arrays in js
please do some research
it's quite easy if you think about it
1) array must be of same length
2) for each element in array 1, the element on the same position in array 2 must match
3) recursively
that's substep of 2
@KarelG so a.length === b.length && a.every((x, i) => x === b[i]) ?
no. you forget that there can be literal objects and other arrays in the main array
@FlorianMargaine 4) recursively
08:02
@BenjaminGruenbaum recursively
Now try doing it without an edit :P
@FlorianMargaine hahahahaha
08:47
@FlorianMargaine still priceless @rlemon
@KarelG and @MadaraUchiha this is how implemented it works but returns every time what i need to do ??
var expected = ['b', 'r', 'o', 'k', 'e', 'n'];
var actual = 'broken'.split('');
function assertArraysEqual(actual, expected, testName) {
return actual.filter(function (e) {
   if(e.actual === e.expected)
   {
    console.log('passed');
   }
   else{
    console.log(`FAILED [${testName}] Expected ${expected}, but got ${actual}`);
  }
});
}
var output =assertArraysEqual(actual, expected, 'splits string into array of characters');
console.log(output);
passed
passed
passed
passed
passed
passed
[]
anyone can ?? i want to return passed only once.
I'm back! I lost my Internet for almost a month!
@Sheepy Who are you again?
@MadaraUchiha You humans are so cruel QAQ

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