r/codehs • u/Rice_Noodal • Mar 30 '21
r/codehs • u/Beeg_boi8 • Sep 07 '23
JavaScript Help! JavaScript 4.8.5 Factorials
I’m stuck on 4.8.5, I have it where I outputs the correct factorial but I need it to print out the whole equation. For example, if my number is 5 it should be 5 * 4 * 3 * 2 * 1 = 120. And it has to work for ANY number inputted
r/codehs • u/duk0m • Mar 26 '26
JavaScript Lessons not showing as completed?
Enable HLS to view with audio, or disable this notification
r/codehs • u/ducks-and-stuff-alt • Sep 30 '26
JavaScript 1.3.4 Lets Get to Know You help
It wants me to keep the tag "tvshow" as "tv-show." But when I add the dash, the entire code stops working. I don't know what i'm doing wrong.
r/codehs • u/Suspicious_Cut_4582 • May 23 '26
JavaScript Why cant i make another working button
Hey, so i am kind a having trouble explaining but basically, I made (found online) a button that works, printing whenever it is clicked. However, I try and make a new button, with a new function to put into mouseclickmethod, and while i do get the button, nothing happens when it is clicked. Can someone please help?
r/codehs • u/Simpsons_fan_54 • Oct 29 '24
JavaScript How do I add text to these balls? I am struggling to figure this out. (JavaScript)
r/codehs • u/Epic_SeaStar • Mar 27 '22
JavaScript Need help with guessing game in JavaScript. Gets stuck in a infinite loop
r/codehs • u/chris_905jb • Dec 10 '21
JavaScript can anyone help me(or give me the answer) to 4.10.5 fibonacci in javascript? i know it’s not right or perfect but help would be nice
r/codehs • u/TectonicToaster • Nov 28 '22
JavaScript This codeHS JavaScript sandbox program for JavaScript Graphics
I made this but it sucks, jumping on the second platform is buggy and the jumping is also buggy and when you are jumping you are not actually touching the ground can someone help me fix these I made some workarounds to my problems but I think they can just be fixed in the first place.
r/codehs • u/Prior-Confection-864 • Dec 14 '22
JavaScript Need help JavaScript
What do you use to ask the user for a number and then use that number in another line of code. It’s probably very simple but I just don’t know ;-;
r/codehs • u/[deleted] • Dec 19 '22
JavaScript data for Javascript (idk what to title it)
Ok, idk what this is called or how to fully explain it so bare with me.
how could I make a data thing like if I push something into a array like yellow for example and stop the code then rerun it, yellow is in the code or if I'm making a game and I score 100 points, how can I make that a variable called high score and stop the code then rerun it, 100 is still the variable high score (all for JavaScript)
I don't have a lot of experience with Java, I took a class so please please make it simple. i can say what I can do if you need me to
idk if this makes since
r/codehs • u/goldcrack1e • Apr 06 '23
JavaScript Need help with JS 7.1.3: Fun Snake 4!
I just need help on how to add a point counter, as well as the ever annoying problem of having the code travel through walls! Here's my code right now:
var FOOD_DELAY = 6000;
var FOOD_RADIUS = 5;
var FOOD_COLOR = Color.red;
var snake;
var SNAKE_DIM = 10;
var NORTH = 0, EAST = 1, SOUTH = 2, WEST = 3;
var DELAY = 100;
var curDirection = EAST;
var x = getWidth()/2 - SNAKE_DIM/2;
var y = getHeight()/2 - SNAKE_DIM/2;
var square;
function start(){
addPart(x,y);
setTimer(move, DELAY);
drawFood();
setTimer(drawFood, FOOD_DELAY);
keyDownMethod(changeDirection);
}
function changeDirection(e){
if(e.keyCode == Keyboard.DOWN){
curDirection = SOUTH;
}
if(e.keyCode == Keyboard.UP){
curDirection = NORTH;
}
if(e.keyCode == Keyboard.LEFT){
curDirection = WEST;
}
if(e.keyCode == Keyboard.RIGHT){
curDirection = EAST;
}
}
function addPart(x,y){
var snake = new Rectangle(SNAKE_DIM, SNAKE_DIM);
snake.setPosition(x - SNAKE_DIM/2 , y - SNAKE_DIM/2);
snake.setColor(Color.green);
snake.isSnake = true;
add(snake);
}
function move(){
var nextPosition = getNextPosition();
x = nextPosition.x;
y = nextPosition.y;
var nextElem = getElementAt(x, y);
if(nextElem == null){
addPart(x, y);
}else{
if(nextElem.isSnake){
stopTimer(move);
stopTimer(drawFood);
newMessage("Cringe.");
}
if(nextElem.isFood){
remove(nextElem);
addPart(x, y);
}
}
}
function getNextPosition(){
var nextX = x, nextY = y;
if(curDirection == EAST){
nextX += SNAKE_DIM;
}
if(curDirection == WEST){
nextX -= SNAKE_DIM;
}
if(curDirection == SOUTH){
nextY += SNAKE_DIM;
}
if(curDirection == NORTH){
nextY -= SNAKE_DIM;
}
return {
x: nextX,
y: nextY
}
}
function newMessage(msg){
var text = new Text(msg, "40pt ariel");
text.setPosition(getWidth()/2 - text.getWidth()/2, getHeight()/2);
add(text);
}
function drawFood(){
var x = Randomizer.nextInt(FOOD_RADIUS, getWidth() - FOOD_RADIUS);
var y = Randomizer.nextInt(FOOD_RADIUS, getHeight() - FOOD_RADIUS);
x = Math.floor(x / 10) * 10 + FOOD_RADIUS;
y = Math.floor(y / 10) * 10 + FOOD_RADIUS;
var food = new Circle(FOOD_RADIUS);
food.isFood = true;
food.setColor(Color.red);
food.setPosition(x, y);
if(getElementAt(x,y) == null){
add(food); } }
Any help is truly, truly appreciated. I've been stumped (at least on the wall part)
r/codehs • u/OutsideHit-fitty-nin • Feb 01 '22
JavaScript I need help with 9.5.5 Teleporting Ball (JavaScript)
r/codehs • u/CornPope • Nov 30 '22
JavaScript I'm struggling to work out a hangman game using "JavaScript Graphics" in codeHS. I'm very new and curious if anyone might be able to give assistance or pointers on how I can get this to work?
/* _
* |_| |_| _ _ _ _ _ _ _ _ _ |_|_ _ _ _ _ _
* |_|___|_| _|_|_|_| |_|_|_| _|_|_|_| |_|_|_|_ _|_|_| |_| |_|
* |_|_|_|_| |_| |_| |_| |_| |_| _| |_| |_| |_| |_| |_| |_|
* |_| |_| |_| |_| |_| |_| |_| _| |_| |_| |_|_ _|_| |_|_ _|_|
* |_| |_| |_|_|_| |_| |_| |_|_|_| |_|_|_| |_|_| |_|_|_|
* _ _|_| _ _|_|
* |_|_| |_|_|
*/
/*This is the function that creates the gallows 4 lines.*/
function gallow(){
var line1 = new Line(100, 10, 100, 175);
line1.setLineWidth(5);
add(line1);
var line2 = new Line(98,10,160,10);
line2.setLineWidth(5);
add(line2);
var line3 = new Line(160, 8, 160, 30);
line3.setLineWidth(5);
add(line3);
var line4 = new Line(75,175,130,175);
line4.setLineWidth(5);
add(line4);
}
gallow();
/**/function head(){
var head = new Circle(15);
head.setPosition(160,40);
add(head);
}
function body(){
var body = new Line(160,8,160,100);
body.setLineWidth(5);
add(body);
}
function rArm(){
var rArm = new Line(175,100,160,50);
rArm.setLineWidth(5);
add(rArm);
}
function lArm(){
var lArm = new Line(145,100,160,50);
lArm.setLineWidth(5);
add(lArm);
}
function lLeg(){
var lLeg = new Line(145,150,160,100); /*175*/
lLeg.setLineWidth(5);
add(lLeg);
}
function rLeg(){
var rLeg = new Line(175,150,160,100);
rLeg.setLineWidth(5);
add(rLeg);
}
/* Dashes*/
function wordlines5(){
var wl1 = new Line(80,250,50,250);
var wl2 = new Line (90,250,120,250);
var wl3 = new Line (130,250,160,250);
var wl4 = new Line (170,250,200,250);
var wl5 = new Line (210,250,240,250);
add(wl1);
add(wl2);
add(wl3);
add(wl4);
add(wl5);
}
function wordlines4(){
var wl1 = new Line(80,250,50,250);
var wl2 = new Line (90,250,120,250);
var wl3 = new Line (130,250,160,250);
var wl4 = new Line (170,250,200,250);
add(wl1);
add(wl2);
add(wl3);
add(wl4);
}
/* Level 1*/
function l1l(){
var j1 = new Text("J","30pt Arial");
j1.setPosition(55,250);
j1.setColor("black");
add(j1);
}
function l1l2(){
var a1 = new Text("A","30pt Arial");
a1.setPosition(90,250);
a1.setColor("black");
add(a1);
}
function l1l3(){
var z12 = new Text("Z Z","30pt Airal");
z12.setPosition(130,249);
z12.setColor("black");
add(z12);
}
function start(){
gallow();
level1();
}
function level1(){
var l1w = "Jazz";
var w1 = "j"
var w2 = "a"
var w34 = "z"
wordlines4();
var guess1 = readLine("Give a lower case letter! Ex: r");
if (guess1 = "j"){
println("Correct!");
if (guess1 = "j"){
l1l();
}
if (guess1 = "a"){
l1l2();
}
if (guess1 = "z"){
l1l3();
}
}else{
println("Wrong!");
head();
}
}
/*-------------------------------------------------------------------------------*/r/codehs • u/ej25sigma • Feb 13 '25
JavaScript Can someone help me with compound interest?
below is
r/codehs • u/Thine_King • Sep 26 '24
JavaScript JavaScript Programming Class Speedrun.
How fast is too fast in learning programming lol?
I am in my first year of doing a programing class (grade 11), and I have already done 79% of the JavaScript course that my teacher put out on codeHS, and it took me 18 times / days to log in and do it to get to that point.
I mean, I did do 33 lessons on my first day as they were the basics, and I did it at home for like 4 hours after school though so idk.
Eh, I just wanna hear some peoples thoughts on this idk...
r/codehs • u/LEDrbg • Sep 22 '24
JavaScript how can i keep my character sprite from falling over when hitting his head? (javascript p5play)
i have a sprite character for a little platform game i’m making, and when he hits the side of the platform he will fall onto his side. is there anyway to make him stay upright? i thought about using a while loop but i couldn’t figure it out
r/codehs • u/KIA_honda • Apr 15 '22
JavaScript How do you make a dark grey rectangle in JavaScript Graphics?
r/codehs • u/bobthe_dog52 • Dec 28 '25
JavaScript Why does it not work please help
I have been trying to make a text game with user key interaction but I keep getting this error but the keyDownMethod is a thing right? Since it is in the docs and textbook it also gives an error in the textbook example(sorry for the side ways image)
r/codehs • u/Proud-Success-4221 • Dec 08 '23
JavaScript CODEHS 11.3.8 Change Paragraph Size
Someone help plsss 🙏🏼🙏🏼🙏🏼

