How to remove the center tag?

Have the following page structure:
<div class="entry-content">

How to remove the tag <center></center> which are stored in the block <div class="entry-content"></div> without removing the contents of the tag <center></center>

The final result should looks like the following:
<div class="entry-content">
April 7th 20 at 15:45
3 answers
April 7th 20 at 15:47
If you are using Jquery, then using it you can:

$('.entry-content > center').contents().unwrap();
$('.entry-content > center:empty').remove();

Alas, the solution in pure js in this case - I don't know. At least that was a normal solution. But using Jquery like this :)
It does not work in the following circumstances:
<div class="entry-content">
<center></center> //deletes empty tag center
<center>121</center> //if the tag is not empty then js removes the tag center

How to do so and the empty center tags will be deleted ? - Nicholaus.Pur commented on April 7th 20 at 15:50
@asa_Effer, updated demo. Now, empty tags are removed. - rafael commented on April 7th 20 at 15:53
Thank YOU very much!! Everything works fine!!! - Nicholaus.Pur commented on April 7th 20 at 15:56
@asa_Effer, Okay...)) good Luck! - rafael commented on April 7th 20 at 15:59
April 7th 20 at 15:49
<div class="block">

var block = document.querySelector(".block");
var centerElements = block.querySelectorAll("center");

centerElements.forEach(center => {
April 7th 20 at 15:51
var centerTextArr = document.querySelectorAll('center');
var centerText = ";
for(var i = 0; i < centerTextArr.length; i++){
 centerText += centerTextArr[i]. innerText() + ' ';
document.querySelector('entry-content').innerHtml = ";
Why is it not working for this script you need to connect the library ?
I have connected jquery.min.js v1.12.4 - Nicholaus.Pur commented on April 7th 20 at 15:54
@asa_Effer, and what he says? Falls by mistake? Or silently not work?
PS You asked a question in the javascript section. What's the connection jQuery? - Lamont_Co commented on April 7th 20 at 15:57

Find more questions by tags JavaScript