I am just starting out with Solidity and I came across this code block meant to deploy a new contract and add the address to an array.
Can someone please explain why the array is initialized this way?
It is different from how I will normally do it in JavaScript
import "./simpleStorage.sol";
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract StorageFactory {
SimpleStorage[] public simpleStorageArray;
function createSimpleStorageContract() public {
SimpleStorage simpleStorage = new SimpleStorage();
simpleStorageArray.push(simpleStorage);
}
}