A Blockchain is a write-only database that guarantees its integrity with cryptographic hash functions. Each block is identified by a hash made from the data it contains, the previous block's hash and other parameters like a timestamp, difficulty and nonce.
The difficulty (or target) represents how many zeros a block's hash needs to start with so it can be added to the blockchain. To mine a block we increment the value of the nonce until we generate a hash that satisfies the difficulty requirements of the blockchain.
Flipping a single bit of any block in the chain causes an avalanche effect on the hashes of all following blocks. This makes it very easy for any node in a decentralized peer-to-peer network to verify the integrity of the blocks.
In this example we use the same Block Header structure that Bitcoin uses. You can manually mine the block by increasing the nonce and checking if it satisfies the difficulty, or you can mine it automatically and add it to the chain. Any difficulty over 4 will lag and slow down your web browser. For some perspective, the current difficulty of Bitcoin is about 20, and people usually mine it with specialized hardware.