RegExp Flags — JS Technical Interview Questions & Answers

g, i, m, s, u and y flags explained.

RegExp Flags

  • RegExp Flags (js) is a JS topic. In plain words you use it for a short RegExp Flags js example in a script in the browser. Don’t start with a slogan — start with that picture.
  • Smallest example: the smallest RegExp Flags js example you can type. Type it, run it, and say what you see. If you can do that from memory, you know RegExp Flags (js).
  • From the example next to this theory: g, i, m, s, u and y flags explained.
  • Trap: only saying “RegExp Flags js” with no example. Fix that before you talk about advanced JS.
  • Viva: what is RegExp Flags (js)? Then show the smallest RegExp Flags js example you can type. Then name the trap.

Technical Interview Tip: What is RegExp Flags (js)? Show this: the smallest RegExp Flags js example you can type. Trap: only saying “RegExp Flags js” with no example.

Code Examples for RegExp Flags

RegExp Flags — working example

// Topic: RegExp Flags
const nums = [1, 2, 3];
const doubled = nums.map((n) => n * 2);
console.log(doubled);
console.log(doubled.reduce((a, b) => a + b, 0));

RegExp Flags: map then reduce on [1, 2, 3]. Say both prints.

How to Explain RegExp Flags to an Interviewer

What is RegExp Flags (js)?

Used for a short RegExp Flags js example a script in the browser Not just the heading

Give one small example of RegExp Flags (js).

the smallest RegExp Flags js example you can type g, i, m, s, u and y flags explained

What mistake do beginners make with RegExp Flags (js)?

only saying “RegExp Flags js” with no example Show the fix

Where do you use RegExp Flags (js)?

a script in the browser a short RegExp Flags js example