To check your flag, run
node jsffs.js some
You should probably know what the code does before you run it though.
Decoding using a JSFuck decoder like https://enkhee-osiris.github.io/Decoder-JSFuck/ gives
const g = "aD0RT3JoTApqC198BgZ5CiFtKSQiGT9EZUJfBGMAGUsGKHJIKkB5Z382FmZdIRcQe0xKYTgZD0h6AhkbfQ5bSA==";let p = (a, b, c)=>()=>{let d = c;while (b(d)) {d = a(d)};return d};let q = (a, func)=>p((b)=>[func(b[0]), b[1]-1], (b)=>b[1], [a, a.length]);let r = (a)=>a.slice(1) + String.fromCharCode(p((b)=>[b[0] ^ a.charCodeAt(b[1] % a.length)].concat(b.slice(2)), (b)=>b.length > 1, [0, 0, 1, 2, 3, 6, 7, 14, 13, 26, 37, 74, 1337, 2674])()[0]);let s = (a)=>q(a, r)()[0];let t = (a)=>btoa(s(a))==g;console.log(t(process.argv[2]));
It's pretty easy to figure out what the script does from here.
Here is a version of the code with better variable names
let loopFactory = (a, b, c)=>()=>{let d = c;while (b(d)) {d = a(d)};return d};
let lengthLoop = (a, func)=>loopFactory((b)=>[func(b[0]), b[1]-1], (b)=>b[1], [a, a.length]);
let shuffleStep = (a)=>a.slice(1) + String.fromCharCode(loopFactory((b)=>[b[0] ^ a.charCodeAt(b[1] % a.length)].concat(b.slice(2)), (b)=>b.length > 1, [0, 0, 1, 2, 3, 6, 7, 14, 13, 26, 37, 74, 1337, 2674])()[0]);
let shuffle = (a)=>lengthLoop(a, shuffleStep)()[0];
let checkFlag = (a)=>btoa(shuffle(a))==check;
Here is a script that reverses the code and prints the flag
function unscramble(a) {
let b = a;
l = a.length;
let xors = [1, 2, 3, 6, 7, 14, 13, 26, 37, 74, 1337, 2674];
for (let j = 0; j < xors.length; j++) {
xors[j] -= 1;
xors[j] %= l;
}
for (let i = 0; i < l; i++) {
let c = 0;
for (let j = 0; j < xors.length; j++) {
c ^= b.charCodeAt(xors[j]);
}
c ^= b.charCodeAt(l-1);
b = String.fromCharCode(c) + b.slice(0, -1);
}
return b
}
console.log(unscramble(atob("aD0RT3JoTApqC198BgZ5CiFtKSQiGT9EZUJfBGMAGUsGKHJIKkB5Z382FmZdIRcQe0xKYTgZD0h6AhkbfQ5bSA==")))