The mapping value storage location

In the solidity doc, the following sentence is written to describe the slot location in storage of a mapped value given the key. It is a bit abstract and the . operator, which is said to be concatenation, can be made more clearly. I wrote a soldity code for a address to uint256 mapping that can illustrate what is going on.

The value corresponding to a mapping key k is located at keccak256(h(k) . p) where . is concatenation and h is a function that is applied to the key depending on its type:

// In Solidity
    mapping(address=>uint256) private _counter; // slot in storage

    function mapLocation(uint256 slot, address wallet) public pure returns (uint256) {
        return uint256(keccak256(abi.encodePacked(abi.encode(wallet), slot)));
// In JavaScript
const value = await provider.getStorageAt(contractAddr, location);