While both Swift and Javascript allow you to assign constants to variables without defining their type, there is a fundamental difference in the two languages. Swift is a strongly-typed, type-safe language while Javascript is not. From The Swift Programming Language -
“Swift is a type safe language. A type safe language encourages you to
be clear about the types of values your code can work with. If part of
your code expects a String, you can’t pass it an Int by mistake.”
Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks.
https://itunes.apple.com/au/book/swift-programming-language/id881256329?mt=11
So when you say
var welcomeMessage = "Hello"
Swift infers that you want welcomeMessage to be a string and sets its type accordingly. Subsequently trying
welcomeMessage=3
will give run a compile-time error because you are assigning the incorrect type.
If you don't assign an initial value then Swift can't infer the type and you must specify it.
Javascript, on the other hand, will quite happily accept
var welcomeMessage="Hello"
welcomeMessage=3
because it isn't type safe and just tries to do the best it can with values it has. For example, if a string operation is performed on welcomeMessage after assigning 3 to it, Javascript would convert the value to "3" and then perform the operation.
While there are type safe extensions to Javascript, it isn't a fundamental part of the language the way it is with Swift