Parity bits are used as very simple checksum to ensure that binary data isn't corrupted during transit. Here's how they work:
Create a function that validates whether a binary string is valid, using parity bits.
validateBinary("10110010") ➞ true
// The last digit is the parity bit.
// 0 is the last digit.
// 0 means that there should be an even number of 1's.
// There are four 1's.
// Return true.
validateBinary("00101101") ➞ true
validateBinary("11000000") ➞ true
validateBinary("11000001") ➞ false