2016-11-09 3 views

Antwort

1

Nein, weil TEST noch nicht definiert ist.
Zum Beispiel, wenn Sie versuchen, diese:

const TEST = { 
    "a1": "world", 
    "a2": "hello", 
    "a3": TEST["a3"] 
}; 

Sie erhalten werden:

Error: Block-scoped variable 'TEST' used before its declaration

Sie können dies tun:

const TEST = { 
    "a1": "world", 
    "a2": "hello" 
} as { a1: string, a2: string, a3: string }; 

TEST.a3 = TEST.a1; 

(code in playground)

+0

vielen Dank für deine Antwort! – takeradi

Verwandte Themen