Learn TYNKER with Real Code Examples
Updated Nov 26, 2025
Code Sample Descriptions
1
Hello World in Tynker (JavaScript transition mode)
console.log("Hello World");
A simple Tynker project that prints 'Hello World' when executed. In block mode, it shows as a 'print' block, while in text mode, the equivalent JavaScript is below.
2
Simple Addition in Tynker
let a = 5;
let b = 7;
console.log(a + b);
Adds two numbers and prints the result.
3
Tynker Loop Example
for(let i = 1; i <= 5; i++) {
console.log(i);
}
Prints numbers from 1 to 5 using a loop.
4
Tynker If Statement
let num = -3;
if(num > 0) {
console.log("Positive");
} else {
console.log("Negative");
}
Checks if a number is positive or negative.
5
Tynker Function Example
function multiply(x, y) {
return x * y;
}
console.log(multiply(4, 5));
Defines a function to multiply two numbers.
6
Tynker Array Example
let fruits = ['apple', 'banana', 'cherry'];
for(let fruit of fruits) {
console.log(fruit);
}
Iterates through an array and prints each element.
7
Tynker While Loop
let i = 1;
while(i <= 3) {
console.log(i);
i++;
}
Prints numbers 1 to 3 using a while loop.
8
Tynker Object Example
let person = { name: 'Alice', age: 10 };
console.log(person.name);
Creates an object and prints a property value.
9
Tynker String Manipulation
let text = 'hello';
console.log(text.toUpperCase());
Converts a string to uppercase.
10
Tynker Random Number
let rand = Math.floor(Math.random() * 10) + 1;
console.log(rand);
Generates a random number between 1 and 10.