JSFiddle - React, Tailwind, and code Playground

JavaScript

function Picture(newImage) {
    if (newImage != undefined) {
        this.pictureArrayAdd(newImage);
    }
};

Picture.prototype = {
    pictureArray: [],
    pictureArrayAdd: function(newImage) {
        alert(newImage);
        this.pictureArray.push(newImage);
        return this;
    }
}

var pic = new Picture("picture1.png");
pic.pictureArrayAdd("picture2.png");