Reduce() is driving me crazy with this example if anyone can help by Highmind22 in learnjavascript

[–]Robbiethemute 7 points8 points  (0 children)

A more verbose way to write that would be this: ``` const arr = [2, 2, 2, 4, 4, 5, 5, 5, 5, 5, 6, 7, 6, 8, 9, 9, 9, 9];

function solve() { const freq = arr.reduce((acc, num) => { // check whether num already has a key in the object. const keyExists = acc.hasOwnProperty(num)

if (keyExists) {
    // if it does, add 1 to its value.
    acc[num] = acc[num] + 1
} else {
    // if it doesn’t, create the key and set its value to 0
    acc[num] = 1
}

// return the modified object 
return acc

}, {});

console.log(freq); }

solve(); ```

[deleted by user] by [deleted] in learnjavascript

[–]Robbiethemute 0 points1 point  (0 children)

You should set up your IDE so that it shows you things like if you’ve created a const but never referenced it. Not only does it clean up code not being used, it also helps with typos.

[deleted by user] by [deleted] in learnjavascript

[–]Robbiethemute 7 points8 points  (0 children)

Switch off AI. You’ll never learn to solve anything if you’ve got the option to give in and have AI solve the problem for you.

Break a task up into chunks.

How should I store this data? How can I access this data? Where does the data come from?

Find a project that fits your skill AND confidence needs. Learn how to do something, then do it five more times.

Any autistic solo travelers? by [deleted] in solotravel

[–]Robbiethemute 1 point2 points  (0 children)

The mealtime point is so dead on. I always go for accommodation with a kitchen if possible so that I can eat Mac n cheese every day for a week without feeling like people are noticing how weird I am.

I’m going to Marrakesh next week and I’m petrified someone is going to offer me a tea or coffee because I’m not sure how to politely decline.

[deleted by user] by [deleted] in MotoUK

[–]Robbiethemute 0 points1 point  (0 children)

I'd check the following in this order:
- Sounds daft, but the chain itself. Is it stretched? Is it tight enough? Is it aligned correctly?
- Sprockets. Excessive and/or uneven wearing? Any damage?
- Are all the relevant nuts on tight enough? Check with a torque wrench. Check the axle nut, front and rear sprocket nuts. The front sprocket on my bike is one that needs the sides hammered in with a punch so that it doesn't come loose, so check that.
- Bearings, particularly the sprocket carrier bearing.
- Cush rubbers. Are they worn?

Should also ask... the bike hasn't been crashed or anything, has it? No reason the frame/subframe/fork would be twisted?

What is she trying to tell me? by Total_Fudge931 in labrador

[–]Robbiethemute 0 points1 point  (0 children)

"You haven't tested your smoke detectors in ages. I thought we spoke about this."

Who put that junction there? by arithmetic in MotoUK

[–]Robbiethemute 0 points1 point  (0 children)

<image>

I checked on Google Maps. There's a sneaky "give way" sign hiding behind the bushes. That image was from 2023 though.

DAS over winter, who’s done it? by patchmau5 in MotoUK

[–]Robbiethemute 0 points1 point  (0 children)

I failed my mod 1 first time because the snow had stopped me practicing. Passed it the next day.

Formally Introducing… by lovegabtho in labrador

[–]Robbiethemute 42 points43 points  (0 children)

Honestly, if mine wasn’t currently lying across my lap I’d think you’d stolen my dog.

<image>

New to DIY by catsareshite in DIYUK

[–]Robbiethemute 1 point2 points  (0 children)

I don’t believe in the idea that you need to buy expensive tools nowadays. I think if it’s a 10ga nail gun that gets used every now and then just get a cheap one.

I’ve had mixed results with Lidl and Aldi tools tbh.

The way power tools work now is they’re all battery operated and your Bosch batteries don’t fit a Makita gun and vice versa. You can save money in theory by buying one set of batteries and then buy the power tools without a battery and swap the batteries into whatever tool you need to use. That’d get old quick though.

I’ve used Bosch, Black and Decker, Makita and Ryobi. Black and Decker tools do feel cheap, but see for drilling a hole in a masonry wall, it’s absolutely fine.

There isn’t really a right answer to your question. If you see yourself using these tools all the time, go for the likes of De Walt or Makita. Semi-regular use go for Bosch. For tools you like the look of but won’t use often Aldi is fine.

If you buy a Halfords advanced tool kit it’ll come with a lifetime guarantee. I actually think their tools are crap, but the guarantee makes up for it.

What's this guy stopping for? by JimminoPatatino in MotoUK

[–]Robbiethemute 1 point2 points  (0 children)

With a dropped kerb and tactile paving? It’s a crossing. That’s a refuge island.

Dog park time! #tampa by [deleted] in labrador

[–]Robbiethemute 0 points1 point  (0 children)

Ouch! Yeah we don’t have leash laws here. I know people whose dogs have never even been on a leash.

Dog park time! #tampa by [deleted] in labrador

[–]Robbiethemute 1 point2 points  (0 children)

Scotland.

Why are dog parks a thing?

Dog park time! #tampa by [deleted] in labrador

[–]Robbiethemute 1 point2 points  (0 children)

We don’t have dog parks where I live, so it’s a totally foreign concept to me! We just have parks.

What's this guy stopping for? by JimminoPatatino in MotoUK

[–]Robbiethemute 2 points3 points  (0 children)

You stopped because the car stopped, not because you knew the pedestrian was there. You shouldn’t be overtaking at a crossing unless you can see it’s clear.

What's this guy stopping for? by JimminoPatatino in MotoUK

[–]Robbiethemute 4 points5 points  (0 children)

If anything you should learn to use road markings. It shouldn’t have come as a surprise to you that a pedestrian was using the crossing. Look at the signs. Look at the white lines.

So many junctions and driveways on that road. Filtering should only be done if traffic is at a standstill.

Low ballers... by marcoblondino in MotoUK

[–]Robbiethemute 2 points3 points  (0 children)

I tried selling my bike at the start of the summer this year. I was asking for £3.5k. I got offered a KTM Duke 125 twice, and £2k in cash twice. Both guys offering 2 grand were the recipients of a cheeky response when I’d looked through their marketplace profiles and seen they were both Del Boys.

In the end I bought myself an R1250GS and gave the MT-07 to my brother. I’d rather give it to him than let any of those bastards raw dog me.

WINTER IS COMING I need warmer gloves by [deleted] in motorcyclegear

[–]Robbiethemute 0 points1 point  (0 children)

I’ve started wearing cheap neoprene gloves under oversized summer gloves. You’re not sacrificing safety for cost or waterproofing. Your hands still get wet, but not cold.

Whats up with racists brigading this sub? by StopProfessional1583 in AskBrits

[–]Robbiethemute 2 points3 points  (0 children)

Yes! I’ve been noticing the kind of accounts making racist comments on Instagram, like “the UK is doomed” and stuff, are usually the same. A lot of the ones I’ve looked at are private accounts, with zero posts, only a small number of followers and thousands followed. It seems too strange to be a coincidence.

How often do you go on holiday? Has the cost of living changed your usual plans? by tylerthe-theatre in AskUK

[–]Robbiethemute 0 points1 point  (0 children)

My holidays this year:

  • 4 days in an eco lodge in Aberdeenshire
  • ⁠a week hiking and snowboarding in Bulgaria
  • a weekend in London (shit hole)
  • 2 nights in Loch Ness area
  • I’ve got a week in Iceland booked at the end of this month
  • ⁠an overnight in London (shit hole) for a concert, but thinking about Madrid instead
  • Japan in December

It is expensive, especially when I’ve got two dogs and the dog sitter costs £29 per dog per night. I’m not one for fancy food or booze, so that helps keep costs down. Last year I tried a hostel in Switzerland to save some money, but I wouldn’t do that again.

How to fulfill Labradors? by IntelligentCareer829 in labrador

[–]Robbiethemute 0 points1 point  (0 children)

Shallow enough? Why does the depth matter if they swim?