Skip to content

Instantly share code, notes, and snippets.

@idettman
Last active October 29, 2025 04:43
Show Gist options
  • Select an option

  • Save idettman/26a7c151345ab6b98ed654b899fd272a to your computer and use it in GitHub Desktop.

Select an option

Save idettman/26a7c151345ab6b98ed654b899fd272a to your computer and use it in GitHub Desktop.
JavaScript Interview EP
/**
* @param {Object} obj
* @returns {string}
*/
function getFirstKey(obj) {
return Object.keys(obj)[0];
}
/**
* @type {Object}
*/
const container = {};
/**
* @type {string}
*/
const containerId = 'widgetContainer';
// JS define variable keywords
// when to use let vs const
// const
// what is the scope behavior for const
// when is the const available for use when defined beneath where it is being accessed
//
// what happens when a const is not set a a value
// const is set to undefined and then set again
// const is set to a value and then set to another value
// const is set to a reference and then set again to the same reference
// const is set to a reference and then set again to a new reference
// let
// what is the scope behavior for let
// var
// what happens when a var is used when the js file has the "use strict defined at the top of the file"
// what happens when a variable is set to a value when it has not been defined
// is there any difference when the js file is not in strict mode?
// what happens when a variable is set to a value when is has already been defined
// JS Types related to numbers (int,float,NaN,-1)
const numExZero = 0;
const numExInteger = 1;
const numExFloatingPointRound = 1.0;
const numExFloatingPointDecimal = 1.1;
const numExFloatingPointRoundNegative = -1.1;
const numExFloatingPointDecimalNegative = -1.1;
const numExNotANumber = NaN;
const numExZeroDividedByZero = 0/0;
// event loop
// how to skip to the next js execution loop
// setInterval, setTimeout (when to use the timer vs the render event)
// add event listener for the render event (what happens to the scope in the render event)
// what happens when the js event loop has code that takes longer? (IE if 60fps/30fps)
// what ways cant he event loop be debugged in the developer tools
// Iframes
// what happens when an IFrame is from a domain that is external to the parent domain
// when the IFrame is from a subdomain
// how is the nested iframe able to pass data to the parent
// how is the nested iframe able to access dom elements from the parent
// Document
// what happens when document write is called multiple times
// and when document write is called multiple times but with a time delta between each call
// what happens when document write is called from within an iframe
// Arrays
// mutating vs copying
const arr = [];
// copy an array
// mutate an array
// combine arrays
// combine part of one array with part of another array
// iterating arrays
// using for
// using while
// using Array.forEach
// what are the different scenarios that you would want to use each of the different types
// what are the differences in performance between each of the methods? (chrome, safari, ff)
// regex
// what are the basic usages of regex
// how to define a regex literal
// how to define a custom regex
// what are the performance concerns using the new RegEx constructor, how can it be mitigated
// code security
// code defined dynamically
// what are the ways that js can be constructed dynamically
// cross domain security, what can be done on the front end vs the server
// how to be defensive with user input
// context senarios
// promises usage
// generator usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment