0
Why is Kotlin so similar to JavaScript?
4 Answers
+ 1
That is because most languages are developed from the C language. So you are likely to notice their similarities.
+ 1
Junior Coder That's not just a Kotlin/JS thing. Like Chris Coder said, it's just a lot of languages use C syntax.
C:
int x = 5;
while (x > 0)
{
printf("hi");
x--;
}
JAVA:
int x = 5;
while (x > 0) {
System.out.println("hi");
x--;
}
PHP:
$x = 5;
while ($x > 0) {
echo "hi" ;
$x--;
}
That's why it's so much more important to learn logic and the fundamentals of computer science and problem solving than just focus on syntax when learning to code. Syntax can be easily Google, but knowing when it's appropriate to use that while statement is something to be learned over time.
0
I don't really see what you mean. Kotlin is more verbose than JavaScript and used much more for class-based. People don't really use JS for class-based programming if I recall correctly since everything is an object. What ways do you personally see they are similar? /genuine-question
0
What I meant was the syntax. For example
KOTLIN
var x = 5
while (x > 0){
println("hi")
x--
}
JS
var x = 5;
while (x > 0){
console.log("hi");
x--;
}
That's what I meant