how javascript works different for attributes and properties