Skip to content

Files

Latest commit

0322f02 · Oct 8, 2020

History

History

02_elements-tranasitions

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Sep 19, 2020
Oct 8, 2020
Sep 19, 2020
Sep 19, 2020

Elements

Indexed properties in javascript are called elements and are treated separately from the named properties They are mostly prominent in arrays and used for different prototype method.

Run

   d8 --allow-natives-syntax element-transition.js

Output

01. Packed SMI Elements

const array = [1, 2, 3];

smi_elements

02. Packed Double Elements

array.push(4.44);

packed_double_elements

03. Packed Elements

array.push('x');

packed_elements

04. Holey SMI Elements

const newArray = [1, 2, 3];
delete newArray[1];

holey_smi_elements

05. Holey SMI Elements

newArray[1] = 2;

holey_smi_elements


Once hole is created it cannot be reverted back.

06. Holey Double Elements

newArray.push(3.33);

holey_double_elements

07. Holey Elements

newArray.push('x');

smi_elements