A pot
Rosemary
A pot
Barberry
A pot
Bearberry
A pot
Primrose
1234
let garden = [
	"Rosemary", "Barberry", 
	"Bearberry", "Primrose"
];
123456
for  (const plant of garden) {
if (plant.match(//i) {
cut(plant);
}
}
Lesson 13 / 42

Lesson task •

Cut "barberry" and "bearberry"

Zero time or once

?

Repeats the previous token zero or one times
123
console.log(!!"foobar".match(/^foo\w?bar$/)) // true 
console.log(!!"foo4bar".match(/^foo\w?bar$/)) // true 
console.log(!!"foo42bar".match(/^foo\w?bar$/)) // false 

If you want to match "?" literally, escape it with backslash:

1
console.log(!!"?".match(/\?/)) // true