Basically, we set the name of the element as the argument of the method, and this element will be created afterward.
But you should know that using this method only creates a new element and we still need to use other methods like appendChild() to add this element to a document so that users can actually see it.
document createElement() Method Syntax:
document createElement() Method Parameters
The method takes one argument, and that is the name of the element that we want to create.
For example, if we want to create a <p> element, then the argument of the method would be “p”.
document createElement() Method Return Value
The return value of this method will be a reference to the object that represents the newly created element.