OddPen

Welcome to my blog where I write mostly about technical things!

Welcome to my dev.to series about my takes on Social Media code challenges! This time it's going to be awesome. You will learn something about an API you use daily: length! You read that correctly. Length. Let's jump right in 👉

The Snippet

const numbers = ['100', '200'];
numbers.length = 0;

console.log(numbers[0]);
Read more...

Welcome to one of the articles about destructuring a coding quiz from Social Media. This time, we check out a very funny sorting algorithm. Be prepared to order numbers with timeouts!

The Snippet

const numbers = [29, 11, 201, 7, 99, 912, 39, 31];

for (let num of numbers) {
  setTimeout(() => console.log(num), num);
}
Read more...

Welcome to the series about destructuring a JavaScript quiz from Social Media. This Sunday, you'll learn about the one API you should never use: eval.

⚠️ Executing JavaScript from a string is an enormous security risk. It is far too easy for a bad actor to run arbitrary code when you use eval(). Read more at MDN

The Snippet

function challenge(input){
  eval(input.toUpperCase())
}

// provide an input that makes function challenge call alert(1)
challenge('alert(1)');
Read more...

Welcome to the series about destructuring those over-shared JavaScript quizzes on Social Media. Have fun digging into default values!

The Snippet

let year = 2020;
const evolution = (defaultYear = 2000) => {
  year = defaultYear;
}
evolution(null);
console.log(year);
Read more...

Welcome to my series about destructuring those JavaScript quizzes on Social Media. Enjoy the fifth episode!

The Snippet

let arrOne = [8];
let arrTwo = [9];

console.log(arrOne == 8);
console.log(arrTwo == 9);
console.log(arrOne < arrTwo);
Read more...

Welcome to my series about destructuring one of those frequently shared JavaScript quizzes on Social Media. This is the fourth episode featuring one of the oldest JS tricks!

The Snippet

console.log(0.1 + 0.2);
console.log(0.1 + 0.2 == 3);
console.log(0.1 + 0.2 === 3);
Read more...

Peer reviews are a broad topic with infinite things to learn and discuss. And they can be scary, especially when you have just started your professional tech career. In this post, I will share some thoughts on the worst (is it?) thing that can happen: your PR is ripped into pieces.

Read more...

Another episode in my series about destructuring JavaScript quizzes from Social Media. This time we try to guess the length of a very special string!

The Snippet

const stars = `
  ⭐
  ⭐⭐
  ⭐⭐⭐
  ⭐⭐⭐⭐
  ⭐⭐⭐⭐⭐
`;

console.log(stars.length * 2);
Read more...

Let's destructure a social media code quiz about hoisting in this second episode of my series. 🎉

The Snippet

function fooBar() {
  try {
    console.log(foo);
  } catch (error) {
    console.log(error.name);
  }
  try {
    console.log(bar);
  } catch (error) {
    console.log(error);
  }
  var foo = 'hello';
  let bar = 'world';
}

fooBar();
Read more...

This is a series where I (quickly) destructure one of those often shared snippet quizzes on Social Media. Welcome to the first episode!

Snippet

const myList = [['❤️'], ['JSSnippets'], ['❤️']];
const mySet = new Set(myList);
console.log(mySet.size);
Read more...