« first day (3391 days earlier)      last day (1551 days later) » 
03:00 - 16:0016:00 - 22:00

4:07 PM
It's interesting to me that the second return statement does not execute for each recursive call but only executes when the first return statement executes or in other words the second return statement only executes when the recursive function stops calling itself which happens when the first recursive call executes
@JBis @Neil is my understanding correct?
@Neil Yes I understand your explanation perfectly. Come to think of it, recursion in this way is actually just as intuitive as looping over an array to sum its values
@Neil the final condition being if (index > array.length - 2) { return array[index];} also makes perfect sense, thanks
 
Sounds right @MyWrathAcademia
 
@Neil what is this literal stack you speak of? Is it some kind of data structure?
 
Now go figure out Neils crappy input challenge
 
3 hours ago, by Neil
but once you realize that you can use a literal stack instead of recursion, recursion is just inefficient
@JBis do you mean this one:
3 hours ago, by Neil
we've written you several examples of how to write a recursive function for finding the sum of an array of numbers
3 hours ago, by Neil
the true test (and I'll leave it to you) is to find the sum of a tree of numbers: [1, 2, [3, 4, 5], 6, 7, [8]]
 
^ that one (although thats more of a challenge and not something you should encounter irl)
 
4:22 PM
I'll get to that but next I will try multiplying an array of numbers using recursion
@JBis @KevinB @user220944 where can I practice things like recursion, closures where I apply them to solve problems instead of just making up examples for myself? Do you know of any websites to practice topics like recursion, closures etc. using JavaScript?
 
I know of general JavaScript teaching websites, not specifically ones for recursion.
 
Coding challenges often involve recursion
 
freecodecamp.com is one and
 
I see. What about a website like codewars?
 
Sep 16 '19 at 21:38, by forresthopkinsa
I HIGHLY recommend taking the online course Practical Javascript from start to finish
he's only mentioned it 12 times
 
4:28 PM
I'm reading the MDN JavaScript Guide at the moment which is brilliant for theory but in terms of exercises/practice I would like a website dedicated to just that because I'm already covered when it comes to the theoretical side of JavaScript
@user220944 where can I find those coding challenges
 
Yes. MDN is a great resource once you know the basics
@MyWrathAcademia codewars.com/dashboard
try this one (you can with recursion but its kind of pointless)
 
@JBis Does codewars breakdown or categorize challenges/exercises e.g. a specific category for recursion exercises, one for closures, etc.?
@JBis thanks for the link. I'll check out codewars
 
@MyWrathAcademia it breaks down into categories but not necessarily recursion
 
@JBis Why do you say that doing the challenge you linked using recursion is pointless?
@JBis so then how do you find challenges to practice using recursion?
@JBis Is it just that any challenge that can be done with a loop can also be done using recursion?
 
FYI if we are the only ones having a convo and your aren't responding to a specific message, no need to ping each time
There are better ways to do the challenge than recursion but you can if you want
 
4:39 PM
Oh that's good to know, thanks.
 
You can lookup common recursion problems, language doesn't matter
 
I now have to ask how to know what common recursion problems are. A quick google search shows me problems requiring knowledge of advanced data structures which I don't have yet
 
check that link
 
@JBis Wow that link is exactly what I need
If only the website you linked also had problems for practice with closures
 
V.7
Okay ...
Getting Error: error:unpr Unknown Provider when included ngAnimate from Getting Started page material.angularjs.org/latest/getting-started
What might this mean?
Also, worth to mention that changed 1.7.6 version from links inside <head> tag part to 1.3.0 because already installed AngularJS exists on corporate server
 
5:04 PM
@MyWrathAcademia theres nothing to practice with closures
its just a function within a function thats accesses stuff in the parent functions scope boom done
module.exports = {
    pool: {
        singleRow: async () => {
            const result = await pool.query(...arguments);
            return {row: result.rows[0], result: result};
        },
I am then calling singleRow from a different file. But it seems the arguments object is being maniptulated. It contains 5 args instead of the 2 i passed and they contain the path of different modules. Any ideas?
 
@V.7 looked into that a bit, looks like the minimum you can do with Angular Material is 1.3.6
 
V.7
Thank you @Cameron
Used MDL
Although, interesting how did you do that?
Using change logs? How exactly?
 
0
Q: How to setup Angular Material for AngularJS 1.3.0

ZabsI am trying to implement Angular Material into an app that is using Angular 1.3.0 (the lowest version that Angular Material supports). I have an index.php that contains the following: <script src="bower_components/jquery/jquery.min.js"></script> <!-- Angular Material style sheet --> <link rel="...

Same error, found some other questions where 1.3.6 was working
 
Hey could anyone help me, I was trying to make a new string prototype to get the text between 2 of a character, but I cant get it working the way I want.
String.prototype.betweenChar = function(e) {
 var rgx = "\\" + e + '([^' + e + ']+)' + "\\" + e;
 var rgx2 = new RegExp(rgx, 'g');
 return this.match(rgx2);
}
currently
it returns the string, plus the characters
so....
var extraString = "Hello there *Good Sir* Im Me";

console.log(extraString.betweenChar("*"));
returns *Good Sir*
 
V.7
Ha. Roger that @Cameron
 
5:13 PM
@TaylorS why are you obsessed with extending prototypes?
 
shush just help me fix it XD
I like my modded prototypes :3
and im proud
>:3
 
Hey folks, just a quick question. Can we return by reference in javascript? Like we can do in php.
 
Well JBis? on a serious note, how do I actually remove all the instances of the chosen character?
so that when it returns "*Good Sir*" or ["*Good Sir*", "*foo*", "*bar*"]

I can sift through the array, or just edit the main string, and remove the *
Also, about the prototypes, they are just quick and dirty, I usually convert em to classes anyways
 
V.7
@user31782 Does not it by default return reference?
Effectively, you only ever deal with references to objects in JavaScript. Even var foo = {} just assigns a reference to a new object to foo.
20
Q: Does a Javascript function return objects by reference or value by default?

Hammad AkhwandI have an object defined outside the function, in a global scope. This object is not passed into the function as an argument, but the function does modify it and return the modified object. What I wanted to know is, if the function returns a copy of the object, or the original global object? Al...

 
@V.7 But that's with the object(which sort of act like references), what about normal variables?
 
5:31 PM
Once again... more terrible dynamic regex bullcrap that doesnt actually work...
  var rgx4 = rgx3.toString();
  var re = new RegExp("\\"+e, "g");
  rgx4.replace(re, '');
  return rgx4;
 
On the topic of regex: is it safe to let a user provide regex as search query?
Or can regex itself damage/strain a server?
 
Hello guys, I have a function with this piece of code that get the value of an html input : var clientData = document.myform.data.value; and i'm trying to use variable instead of myform and data, i thought it was as simple as document.var1.var2.value; but it isn't, any idea of the syntax I should use ?
 
@MaxDev99 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.
 
Where should i ask logical javascript/jquery questions without providing any code because i just don't know how to accomplish somethng? I'm trying to prevent downvotes
 
@drpzz You should look up a tutorial then.
 
5:36 PM
There ain't any haha, it's a tricky question. I'mma try asking here then?
 
If you have question "because" of a tutorial instead of providing code you provide the phrase in the tutorial with which you need help.
You can, though if it's not a simple thing all I would do is just curate where to ask.
 
@paul23 Regex straining a server? mmmm... no that doesnt sound right. Regex isnt that performance sensitive (excluding enormous complex calculations)

and messing with the server? isnt that client sided? I may be wrong
JS Regex should all be done client sided
so that shouldnt matter as far as I know
 
@TaylorS Well one could see something like a search bar that searches in a table for entries matching regex.
 
Hi guys can one assist me? I'm trying to match just the home page of YouTube for a Firefox extension, but it seems to be matching for every page?
 
@AshKetchum 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:39 PM
"matches": ["*://*.youtube.com"],
 
So then on the server the regex would be executed to return a subset of the table.
And regex is quite computationally expensive compared to other actions. The question is: is the performance bounded with a sane limit.
For example xml isn't, I could produce an xml script that takes an exponential time to parse.
 
5:58 PM
So here's my tricky question, hopefully someone could point me in a right direction
https://codeshare.io/adVdKz
 
@AshKetchum you should be able to do "*://youtube.com"
@paul23 interesting question
I suppose, from a security standpoint, it would be fine as long as you handle it properly.
Assuming you are using node, I would run it in a different thread and have a timeout. If it exceeds the timeout, end the process and tell the user it timed out.
 
6:14 PM
@JBis Well question is: can regex even take more than o(n*m) time
(so linear with both regex length and search string length)
 
regex length doesn't dictate regex complexity or the time it takes
 
If y'all don't mind helping me with my issue you can hop onto my question's page, been struggling with it for soo damn long already haha
https://stackoverflow.com/questions/59954758/saving-users-location-in-a-javascript-object-hierarchy
 
 
2 hours later…
8:12 PM
Anyone know of a basic Antialiasing API or something between JS and CSS?

Ive noticed that although making 3D objects in CSS is fun and easy, its also a pain in the ass for reasons like sharp corners and such
filter: blur(1px); is the lowest blur ratio you can use, and its TERRIBLE looking for my project...
but I reallllly dont want those sharp edges
 
8:29 PM
try NOT to tell me this looks kinda shitty with the default rendering system: codepen.io/SkylerSpark/full/XWJGapP
 
Taylor, its frustrating to help you use tools for things that they aren't meant for. Its a reoccurring trend: You want to do X and Y is the best way to do it, but instead you want use Z to do it. You have difficulties using Z because its not meant for/isn't the best utility to do what you want, so you ask here. Today X is 3d rendering, Y is canvases (which you have experience with), and Z is CSS 3D transformations.
Use canvases for complex 3d rendering
I don't mean to be rude, if it came off that way.
 
but css
 
Kevin, you think css is the best tool for this?
 
i think 3d transformations on web content/apps are useless
 
8:45 PM
Cheasy css 3d transformations make websites look like its a 1990s website which is ironic because 3d css transformations didn't exist back then
 
so they look like flash?
 
sorta...yeah
 
I'm not a fan of effects that draw attention
they should be subtle and/or guiding in a way that leads you to the destination without actually being seen
 
slightly relevant ^
 
yup
 
8:59 PM
It's said that the only intuitive interface is the nipple. New mothers will tell you that this isn't true. The nipple isn't that intuitive either.
 
user8729657
How can I check if a button is disabled?
 
user8729657
  const btn = document.getElementById("cartButton");
    document.addEventListener('click', function () {

      if (document.getElementById("cartButton").disabled) {
        console.log("Disabled");
      } else {
        console.log("not working!");
      }

    });
 
?
 
user8729657
I'm trying to check whether or not my button is disabled
 
works for me
you're not clicking the disabled button are you?
 
9:02 PM
What's the method for putting default "Enter/Select a ....." text in a textbox or dropdown that's greyed that goes away when the user starts typing or selects an option
 
user8729657
I am :/
 
well, it's disabled
so it can't receive events
 
user8729657
:O
 
@Hypersapien placeholder
|| mdn input placeholder
 
9:04 PM
your useless james
 
Thanks
 
*my
 
user8729657
@KevinB, you blew my mind just now lol
 
how? Cause he told you disabled buttons are disabled?
 
9:05 PM
how
 
lol
 
i mean, it's an easy mistake to make
 
user8729657
Because the disabled button can't receive events lol
 
9:45 PM
cya o/
 
o/
 
03:00 - 16:0016:00 - 22:00

« first day (3391 days earlier)      last day (1551 days later) »