Menu
CoddyTech
Course

Kotlin for JavaScript Developers

Move from JavaScript to Kotlin through static types, null safety, collection ownership, functions, properties and object contracts. Build a connected multi-file order processor and port a stock ledger.

JavaScript and Kotlin side by side

The same program in JavaScript and in Kotlin, from the lessons of this course.

  1. Strings and Templates

    JavaScript uses backticks and dollar-brace interpolation, while Kotlin double-quoted strings support dollar-prefixed names or braced expressions. Single quotes in Kotlin denote Char, not a second string-literal style. Both examples print a newline. Kotlin/JVM…

    JavaScript
    1const ready = 3;2console.log(`Ready: ${ready}`);
    Kotlin
    1fun main(){2val ready=33println("Ready: $ready")4}
  2. Equality and Identity

    JavaScript strict equality compares primitive strings by value but objects by identity. Kotlin == delegates to equals and === checks identity. Strings compare text, while ordinary classes do not automatically gain deep field equality. Data classes and…

    JavaScript
    1const a = String.fromCharCode(116, 101, 97);2console.log(a === "tea");
    Kotlin
    1fun main(){2val a=String(charArrayOf('t','e','a'))3val b=String(charArrayOf('t','e','a'))4println(a==b)5}
  3. Arrays and IntArray

    JavaScript arrays grow and can hold mixed runtime value types. Kotlin arrays have a fixed size and a declared element type, with IntArray providing primitive integer storage on the JVM. Accesses are bounds-checked and negative indexes are invalid. Use last or…

    JavaScript
    1const values = [4, 8, 12];2console.log(values[values.length - 1]);
    Kotlin
    1fun main(){2val a=intArrayOf(4,8,12)3println(a.last())4}
  4. While, Break, and Continue

    JavaScript and Kotlin both use while, break and continue, but Kotlin conditions must be Boolean. Handle a stop marker before normal processing and keep skipping an empty item separate from ending traversal. A manual index must advance on every continuing…

    JavaScript
    1const kept = [];2for (const word of ["tea", "", "STOP", "coffee"]) {3    if (word === "STOP")4        break;5    if (word.length === 0)6        continue;7    kept.push(word);8}9console.log(kept.join(","));
    Kotlin
    1fun main(){2val kept=mutableListOf<String>()3for(word in listOf("tea","","STOP","coffee")){if(word=="STOP")break;if(word.isEmpty())continue;kept.add(word)}4println(kept.joinToString(","))5}
  5. Top-level Functions

    JavaScript functions are dynamically typed and may omit returns or accept extra arguments. Kotlin functions declare parameter types and non-Unit block bodies require returned results on normal completion paths. Top-level helpers need no class wrapper. Kotlin…

    JavaScript
    1function isLong(text) { return text.length > 4; }2console.log(isLong("coffee"));
    Kotlin
    1fun isLong(text:String):Boolean = text.length>42fun main(){3println(isLong("coffee"))4}
  6. Input and String Formatting

    Console JavaScript hosts provide their own input APIs, while these Kotlin tasks supply a locked line-reading driver. Kotlin readlnOrNull exposes EOF as null and toInt requires valid complete numeric text. Trim only when the contract allows it. Format exact…

    JavaScript
    1console.log("  tea  ".trim().toUpperCase());
    Kotlin
    1fun main(){2println("  tea  ".trim().uppercase(java.util.Locale.ROOT))3}

Syllabus

10 chapters48 lessons1 project48 challenges99 quiz questions

Final Challenges

2 lessons

More courses for JavaScript developers

Learn Kotlin from another language

Frequently asked questions

Who is Kotlin for JavaScript Developers for?

For people who already write JavaScript and want to learn Kotlin. Each lesson starts from JavaScript you know and shows how Kotlin does the same thing, so you skip the beginner basics.

Do I need to know Kotlin already?

No. The course starts with your first Kotlin program. You need JavaScript basics: variables, conditions, loops, functions and collections.

How many lessons does Kotlin for JavaScript Developers have?

Kotlin for JavaScript Developers contains 48 interactive lessons you can complete at your own pace.

What does Kotlin for JavaScript Developers cover?

The course is organized into chapters covering: Starting Kotlin, Values and Decisions, Collections and Ownership, Iteration and Transformations, and more.

Is Kotlin for JavaScript Developers free?

Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.

Coddy programming languages illustration

Start Kotlin for JavaScript Developers for free

Get started