Question: So I am trying to add some images dynamically that are uploaded from pc to a gallery div. But when I add them with their class names, their styling is the default and not their class styling. 
I know that I can add the styling dynamically when adding the image but the styling of the class is very large. Is there any possible way we can add the styling of the class but not when we add the image?

```js
function uploadImage(){
 var appendedText="<div class='p-item grid-sizer'><a class='venobox' href='images/porfolio-16-300x500.jpg'><img src='images/porfolio-16-300x500.jpg' alt=''/></a></div>";
 var x=document.getElementsByClassName("p-grid-isotope");
 x[0].appendChild(appendedText);
}
```

```html
<section class="main-section" >
    <div class="p-grid-isotope" >
     <div class="p-item grid-sizer" ></div>

    </div>
</section>

<button type="submit" id="upload-img" class="following-button" style="color: white; margin-top: 30px; margin-left: 18%" onclick="uploadImage()"><span class="icons i1"><i class="fa fa-upload" aria-hidden="true"></i></span>Upload to account</button>
```

Answer: 
The problem is how you're prompting again with this `prompt(userNum)`

* First, extract the prompt part.
* I recommend you to use `do-while-loop` for looping and ask for a number when is not a number.
* Use the object `Number` instead to avoid problems with strings like this `4yryr`

```js
function askFor() {
  return Number(prompt("Give me a number and I'll tell you it's square-root."));
}

function sqrtUserNum() {
  let userNum;
  do {
    userNum = askFor();

    if (isNaN(userNum)) {
      alert(NaN);
    } else {
      alert(Math.sqrt(userNum))
    }    
  } while (isNaN(userNum));
}
sqrtUserNum();
```
Programming is a good bit about following grammar rules, and the following is 'dubious':

```
if (!isNaN(userNum)); {
  alert(Math.sqrt(userNum))
}

```

This is because the extra `;` causes it to be parsed as:

```
if (!isNaN(userNum)) /* do nothing */;

/* block unrelated to conditional, which is always executed */
{
  alert(Math.sqrt(userNum))
}

```

See the [Block Statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/block)