« first day (4937 days earlier)      last day (11 days later) » 

1:27 AM
Hi
 
@HamesRodrigues 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.
 
i have a question please
hi guys
needed one help pleaseeeeeee

```
i dont know why this code does not give me desired code when i run it on my compiler as it gives the output "modifiedstring" as same as input and not the correct output which shud be having only one B as the code decreases the number of B from the input Please help guys please

function adjustLetterCount(inputString, letter, adjustment) {
// Split the input string into individual characters
const characters = inputString.split(' ');

// Initialize a variable to keep track of the count of the letter
 
1:44 AM
        function adjustLetterCount(inputString, letter, adjustment) {

                                                                                //  Split the input string into individual
                                                                                //  characters
              const characters = inputString.split(' ');

                                                                                //  Initialize a variable to keep track of
                                                                                //  the count of the letter
ok stackoverflow literally hates my indentation haha
i can tell you why it isnt working
 
0
Q: Stopped-clock illusion for heart palpitations?

Parking MasterDoes anyone else ever feel this specific scenario? For example, I'll feel my heart beating in the background (it's just ambient/background noise), and then when I notice my heart beat and pay attention to it, my heart rate slows down quite a lot. This sort of reminds me of the stopped-clock illus...

Just wanted to post this in case anyone is interested in answering.
 
your first if statement checks if the currentLetter is equal to letter as passed by parameter
ie letter='B'
but currentLetter isnt capable of ever being B from the input string
so it passes to the else block, which simple adds character to replacedString
character is determined from your first split(' ');
then you return replacedString and its equal to the input string
there are some oddities here also
adjustment starts with a value of -1
only ever gets decreased, but you have a check to see if its ever greater than 0
im afraid i cant even guess what you would like the output to be
did you want to take one B out of the input string or something?
@ParkingMaster, yeah that happens to me, not that i have heart palpitations or a heart arrhythmia or anything
also if youre quite fit and you take a deep breath your heart will slow down a little because you have extra oxygen in your blood so its doesnt need to work so hard
someone could either be quite fit or quite slim for that scenario
 
2:23 AM
@matt Didn't know this happened to anyone else because no one ever mentions it. And yeah, I noticed that when taking a deep breath, my heart slows down temporarily, and then it goes back to its normal pace.
 
its a funny organ the heart, it really feels like emotions emanate from it and driving life force around the body
i often feel the body has a simple 'mind' of its own lol
 
2:44 AM
@everybody, can i ask what are peoples primary browser
mine is google chrome on windows
im producing a cute little browser extension, firefox/safari is proving to be law unto themselves lol
 
@matt For me it's Firefox. It's made by Mozilla which I like, and it's kind of easier for developers than using chrome. It's also just a bias opinion because Firefox was the first browser I ever used and I hate change so I just stick with it.
The only issue I've ever had is that it's slower than chrome when it comes to WebGL/Three.js rendering. It's a little slower than chrome.
 
 
14 hours later…
4:36 PM
Hi all
 
@matt FF. I use Chrome for developing, some times. But I'm an old time-y FF user at heart.
I use Brave on my phone, though.
 
The latest version of Edge is causing some issues: there are pages that used to work well 2 weeks ago. Now, the same pages, without any modifications to the code, are hanging when we click buttons. These pages work fine in Chrome
 
4:53 PM
¯\_(ツ)_/¯
 
That's what I thought :)
 
5:18 PM
Guys, When we define two shape objects with following values
let x = { a: 2, b: { c: 3 } };
let y = { a: 5, b: { d: 3 } };

console.log("same map:", %HaveSameMap(x, y));
but the b diff with two unshaped objects
So the console output still print Same map : true
let x = { a: 2, b: { c: 3 } };
let y = { a: 5, b: { c: 11 } };

console.log("same map:", %HaveSameMap(x, y)); // true
console.log("same map for b:", %HaveSameMap(x.b, y.b)); // true
 
@underscore Well, whatever %HaveSameMap is must be wrong.. Both a and b are different. a has a different primitive value, b has a different object defined.
 
posted on April 22, 2024 by Matt

The Dev channel is being updated to OS version: 15853.4.0 Browser version: 125.0.6422.5 for most ChromeOS devices. If you find new issues, please let us know one of the following ways File a bugVisit our ChromeOS communitiesGeneral: Chromebook Help CommunityBeta Specific: ChromeOS Beta Help CommunityReport an issue or send feedback on ChromeInterested in switching

 
@VLAZ what do you meant by must be wrong ?
does it not guaranteed ?
 
You shouldn't get true when comparing two objects that are different.
Well, all the key-value pairs in them are different. The only thing they share is the key names. And only on the first level
 
Yeah the first level
that's is what i noticed
 
 
2 hours later…
7:01 PM
Java doesn't have the back tick quotes!?!?!!
Syntax error on token "Invalid Character", delete this token Java(1610612968)
java cannot be resolved to a variable Java(33554515)
 
@1.21gigawatts Don't think so. Maybe they've added something like template strings in more recent versions but I've not kept up after 10. I've used MessageFormat in the past which is reasonably close to template strings. There is also String.format() and Formatter but the options are more complex and less readable (well, more like printf() in C/C++).
 
Apache Commons also has some more options but if you don't use Commons in your project, it's not worth bringing it just for formatting strings.
 
i use js primarily but i'm working in java for another project
is JS getting more updates than Java?
wasn't Java supposed to be the holy grail of languages?
 
Not sure. Java stepped up the pace of updates, too. It's close to two a year, perhaps. Or maybe 1 update every 9-ish months.
@1.21gigawatts Depends on who you ask. Hint: the answer is "no" for most people who don't use Java.
 
7:12 PM
javascript supposedly has the most questions on SO i think
 
It's more of the "holy grail" of OO. At least I've only really seen it exalted in that regard. And it's not completely untrue. C# would be the equivalent but is less OO-ish. Well, with lambdas and other features...which Java also has now, so... the two languages are back to being close again.
 
not sure if that makes it the most popular or most complicated
i like C#
if i could choose it's prob be that. but also like await and async. not sure if c# has that
 
@1.21gigawatts Or sort of both. It seems a lot of people pick it up because of its popularity. And it's popular because web projects are popular. Also, web projects are "easy" (or marketed as easy), so more people want easy money. Hence why they get into JS, which is also often their first programming experience, thus more questions about "why doesn't it work". Etc., etc.,
@1.21gigawatts It does. From before JS, I believe.
At any rate, the precise semantics are a bit different but in practice, it's almost interchangeable with JS.
A lot of transferable knowledge between the two.
 
i'm having so much trouble with this java project
is it possible for nodejs to call or wrap a java dependency? or artifact? i don't know what it's called
 <dependency>
      <groupId>com.domain</groupId>
      <artifactId>library-or-whatever-it-is</artifactId>
      <version>1.2.3</version>
      <classifier>jdk16</classifier>
    </dependency>
 
@1.21gigawatts Please don't post unformatted code - use the up arrow to edit your post, then hit Ctrl + K to format the code in that post. 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.
 
7:20 PM
the java project imports it at the top and then it calls methods on it
 
Should be possible. Not really sure how, though - I've never player around with it. But node can have bindings for other code - usually written in C/C++ but some modules are also written in Python or R or other languages. So, in theory, I don't see why Java won't be an option. I've never really looked into how it works or how to make it work, though.
 
if i could do the same in a nodejs project i could get around so many hacks
 
You could also do something like spin a server in Java, call it with HTTP calls to localhost on Node.
Probably look into Spring Boot if you want to do that.
If you go down that route, you should be able to set it up in Maven. Note: I don't know how easy it would be, just that it should be possible. In Maven you should be able to have a pom that pulls the Node project, then builds it (if needed) and starts it, then starts up the Spring Boot project. Then the two can start communicating.
 
i'm creating a jar and then calling it using command line arguments
but it's hard to debug
 
That's also an option. Depends on how you want to consume it.
The "old school" way of debugging it is to put a public static void main(String[] args) method in the file you want to check, then run it (since you can run any file which has a method with this signature). In the main method you'd put some code that runs whatever you want to try.
You're better off writing unit tests, though.
 
7:29 PM
Here's what I have so far:
argsValue = "test.doc --argument1 1";
args = argsValue.split(/ +/);
except I'm getting errors:
Syntax error on tokens, Expression expected instead Java(1610612973)
 
argsValue.split(" +") probably. There isn't a regex literal in Java
You still use a regex in a string, though.
 
i have had issues with javascript but in the last year it's been getting the job done (sortof) a bit with the help of typescript
 
Kotlin is suppored to be "the better version" of Java. If that helps. Well, AFAIK, it's not Java but still executes on the JVM and should be similar at least.
 
i looked into it and was impressed
i don't remember why i didn't or couldn't use it at the time
if i could run it in vscode for nodejs i probably would
would a space in the command line arguments cause weird behavior?
argsValue = "test.doc --argument1 1 --argument2 true";
  `argsValue = "test.doc --argument1 1      --argument2 true";`
 
When calling a JAR? AFAIK, you should get each argument in args in the main method.
Although, TBQH, I've never actually used the args array for more than one argument. And I might have used the args array once. Or twice. I don't have a lot of first hand experience.
I'd expect calling myJar arg1 arg2 arg3 to give you three args in the main method.
 
7:43 PM
ok
that string.split(" +") worked btw
 
but I might also be wrong
 
or didn't throw an error
i'm using string literal or string template whatever backticks is
but i will try to push the arguments in an array and then join them with a space and see if that fixes things
i don't like calling exec process because seems like too many parts
 
@1.21gigawatts It's not great. Very messy and not easy to enforce a proper API. Although, it's at least simple. Simpler than running an HTTP API which you then need to call.
 
i will put the args in arrays and if that doesn't work going to return json string from the jar standard out so i can get better error messages
do you have a wishlist for js?
 
1. bind operator https://github.com/tc39/proposal-bind-operator
2. Pipe `|>` https://github.com/tc39/proposal-pipeline-operator
3. Iterator helpers https://github.com/tc39/proposal-iterator-helpers
4. Probably a BigDecimal.
Oh, and records and Temporal API.
I mean, other things would also be nice. But these are my personal favourites.
Unfortunately, not much movement on 1. and 2. there.
 
7:56 PM
one day perhaps
i was invited to help or join
but i didn't have the time or resources
*invited to tc39
 
8:40 PM
with the URL.hash it returns as "#myhash"
do you remove the # sign manually? or is there helper classes for it?
the URL class is new and helpful i would have thought it would have just returned the hash
as an object
based on that the Query does have helper methods query.get("search")
hash does have separators just like the query
how odd
 
 
1 hour later…
10:00 PM
*invited to tc39.5 - it's like tc39 but at my house
and theres a dog and cat there
 
10:25 PM
and we have cake
 

« first day (4937 days earlier)      last day (11 days later) »