How to use escapeHtml in Magento 2?

/**
 * Escaper
 *
 * @var \Magento\Framework\Escaper
 */
protected $_escaper;

public function __construct(
\Magento\Framework\Escaper $_escaper
) {
    $this->_escaper=$_escaper
}

Now you can easily use escapeHtml by

$this->_escaper->escapeHtml($data, $allowedTags);

Or If you are using any block or .phtml file then you can use this by

<?= $block->escapeHtml($block->getDefaultValue()); ?>

EDIT[As per requested]

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$escaper = $objectManager->create('Magento\Framework\Escaper')->escapeHtml($data);

You can use it in magento-2 like below

value="<?php echo $block->escapeHtml($block->getDefaultValue()) ?>"