Get Website code by store id programmatically magento 2.

Magento 2, You can fetch website code by just passing store id value.

You required store id to get website code from the passed store id.

You can fetch website code using the below code snippet,

Call function,
echo $this->getWebsiteCodeByStoreId(1);

Output: base