20-02-2026 05:50 PM
Console.log("Hello world");
console.log("Initializing robot game...");
// Step 1: Create the robot object
let robot = {
name: "Robo-ING",
x: 0, // starting position X
y: 0, // starting position Y
move: function(direction) {
if(direction === "up") this.y += 1;
else if(direction === "down") this.y -= 1;
else if(direction === "left") this.x -= 1;
else if(direction === "right") this.x += 1;
console.log(`${this.name} moved ${direction} to (${this.x}, ${this.y})`);
}
};
console.log("Robot created:", robot.name);
20-02-2026 05:51 PM
console.log("Initializing robot game...");
// Step 1: Create the robot object
let robot = {
name: "Robo-ING",
x: 0, // starting position X
y: 0, // starting position Y
move: function(direction) {
if(direction === "up") this.y += 1;
else if(direction === "down") this.y -= 1;
else if(direction === "left") this.x -= 1;
else if(direction === "right") this.x += 1;
console.log(`${this.name} moved ${direction} to (${this.x}, ${this.y})`);
}
};
console.log("Robot created:", robot.name);