no repo for this challenge
no demo for this challenge
Step 1: We’ve Already Done This (but let’s talk abt it)
The challenge is to write a function that takes a string and determines if it is PKCS#7 (doc) padded. If it is, then we remove the padding; if it is not, we throw an error.
This function takes an array and checks the last character. It converts that character into a number and, if that number is between 0 and 256, it checks with
every (mdn docs) to see if that number of characters (
possibleSlice) from the end of the string are all equal to the same value: namely, the length of the padding characters. If they are, then the numbers are removed and the chopped array is returned. If they aren’t, then an error is thrown. Done!