How to return all except last 2 characters of a string? March 4, 2023 by Tarik You are looking for slice() (also see MDC) id.slice(0, -2)