this post was submitted on 28 Oct 2025
64 points (100.0% liked)

Main, home of the dope ass bear.

16066 readers
137 users here now

THE MAIN RULE: ALL TEXT POSTS MUST CONTAIN "MAIN" OR BE ENTIRELY IMAGES (INLINE OR EMOJI)

(Temporary moratorium on main rule to encourage more posting on main. We reserve the right to arbitrarily enforce it whenever we wish and the right to strike this line and enforce mainposting with zero notification to the users because its funny)

A hexbear.net commainity. Main sure to subscribe to other communities as well. Your feed will become the Lion's Main!

Good comrades mainly sort posts by hot and comments by new!


gun-unity State-by-state guide on maintaining firearm ownership

guaido Domain guide on mutual aid and foodbank resources

smoker-on-the-balcony Tips for looking at financials of non-profits (How to donate amainly)

frothingfash Community-sourced megapost on the main media sources to radicalize libs and chuds with

just-a-theory An Amainzing Organizing Story

feminism Main Source for Feminism for Babies

data-revolutionary Maintaining OpSec / Data Spring Cleaning guide


ussr-cry Remain up to date on what time is it in Moscow

founded 5 years ago
MODERATORS
 

Uuuuh just how many of these do we have?

I'm in awe of whoever is in charge

you are viewing a single comment's thread
view the rest of the comments
[–] FumpyAer@hexbear.net 2 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

A more obviously safe command (to me) is to use the .length method.

window.isoData.site_res.taglines.length

Will give you the number directly, and putting .length on the end guarantees that all you're doing with that array is printing the length of it. But I'm a JS beginner!

[–] AernaLingus@hexbear.net 3 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

Very true! Although, in a scenario in which I were actually doing something nefarious, it's not difficult to run arbitrary code whenever a property is accessed—here's a relevant example from StackOverflow using Proxy() and modified to fit our scenario:

// Source - https://stackoverflow.com/questions/44691071/how-do-i-invoke-a-function-whenever-a-property-of-an-object-is-read
// Posted by Andrew Li
// License - CC-BY-SA 4.0

const obj = {};
const windоw = new Proxy(obj, {
  get(target, property, receiver) {
    console.log('HACKERMANS I\'m in');
  }
});
windоw.isoData.site_res.taglines.length; //A property is accessed and the console is logged to

In this case, it'll throw an error, since there is no site_res (or anything below it) in our toy example, but the code in get runs all the same. Also, since window is a reserved global variable, I had to be a little sneaky and swap out the Latin o for a Cyrillic o to avoid the naming conflict.

Anyhow, another advantage of accessing the array is that you can then click to expand it in your browser console and peruse the taglines at your leisure!

Also, hello, fellow Aer! kirby-wave

[–] FumpyAer@hexbear.net 3 points 2 weeks ago

Oh what a coincidence! I didn't notice!