Silver idea award
Watch this thread
emmakola
Badges:
8
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#1
blogbyreviews
Badges:
20
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#2
blogbyreviews
Badges:
20
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#3
emmakola
Badges:
8
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#4
blogbyreviews
Badges:
20
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#5
emmakola
Badges:
8
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#6
Yes it is, when you have to pass the correct sound into the array. I know you do [1] but I can't remember how you call the array
0
reply
winterscoming
Badges:
19
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#7
Report
#7
(Original post by emmakola)
Yes it is, when you have to pass the correct sound into the array. I know you do [1] but I can't remember how you call the array
Yes it is, when you have to pass the correct sound into the array. I know you do [1] but I can't remember how you call the array
(nitpick: The word 'call' usually means 'do a thing' or 'execute an instruction' -- for example you'll often read/hear people say 'call a function' meaning running/executing the code inside that function.. so that doesn't really make sense with an array, which is just a list of items -- The kinds of things you'd normally do with an array would be: add/remove an item, modify (overwrite/change) some existing item, read an item, read its length, etc. )
Anyway, an array has a name just like any other variable. In fact, an array works just like a list-of-variables.
The only extra thing you need to do is add the square-brackets and your position number to the end, and then you can do all the normal things that you'd do with any other variable. e.g. https://repl.it/repls/FeminineExperiencedDecimals
Code:
var myArray = [ "dog", "cat", "bird" ]; myArray[0] = "fish"; console.log(myArray[0]);
the square brackets can use just a plain number for the position - e.g [1], or they can be given another variable which contains a number (Like the 'counter' which you'd use in a "for"-loop -- e.g. [ i ] )
https://www.w3schools.com/js/js_arrays.asp
https://developer.mozilla.org/en-US/..._Objects/Array
1
reply
adamr747
Badges:
2
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#8
emmakola
Badges:
8
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#9
(Original post by winterscoming)
I'm not quite clear what you mean by 'call the array'? Do you mean read an item of data from it? or add an item of data into it? or change an item at a position?
(nitpick: The word 'call' usually means 'do a thing' or 'execute an instruction' -- for example you'll often read/hear people say 'call a function' meaning running/executing the code inside that function.. so that doesn't really make sense with an array, which is just a list of items -- The kinds of things you'd normally do with an array would be: add/remove an item, modify (overwrite/change) some existing item, read an item, read its length, etc. )
Anyway, an array has a name just like any other variable. In fact, an array works just like a list-of-variables.
The only extra thing you need to do is add the square-brackets and your position number to the end, and then you can do all the normal things that you'd do with any other variable. e.g.
The name of the array on its own means 'the complete array' (so the name of the array helps you do things like access/add/remove an item or get its length). The square brackets [ ] are for selecting a specific position, so you need the number for that position.
the square brackets can use just a plain number for the position - e.g [1], or they can be given another variable which contains a number (Like the 'counter' which you'd use in a "for"-loop -- e.g. )
https://www.w3schools.com/js/js_arrays.asp
https://developer.mozilla.org/en-US/..._Objects/Array
I'm not quite clear what you mean by 'call the array'? Do you mean read an item of data from it? or add an item of data into it? or change an item at a position?
(nitpick: The word 'call' usually means 'do a thing' or 'execute an instruction' -- for example you'll often read/hear people say 'call a function' meaning running/executing the code inside that function.. so that doesn't really make sense with an array, which is just a list of items -- The kinds of things you'd normally do with an array would be: add/remove an item, modify (overwrite/change) some existing item, read an item, read its length, etc. )
Anyway, an array has a name just like any other variable. In fact, an array works just like a list-of-variables.
The only extra thing you need to do is add the square-brackets and your position number to the end, and then you can do all the normal things that you'd do with any other variable. e.g.
Code:
var myArray = [ "dog", "cat", "bird" ]; myArray[0] = "fish"; print(myArray[0]);
the square brackets can use just a plain number for the position - e.g [1], or they can be given another variable which contains a number (Like the 'counter' which you'd use in a "for"-loop -- e.g. )
https://www.w3schools.com/js/js_arrays.asp
https://developer.mozilla.org/en-US/..._Objects/Array
0
reply
emmakola
Badges:
8
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#10
This code doesn't work are you able to help?
That's not it. You must:
[ul]
[li]Loop through soundBlocks[/li]
[li]call the playSound() function[/li]
[li]Pass the correct sound from your sound array into it[/li]
[/ul]
for (i=0;i<movementBlocks.length;i++) {
doMovement(movementBlocks[i])
}
for (i=0;i<sounfBlocks.length;i++){
playSound(soundBlocks[i]);
}
soundBlocks[1]=happyBeep;
print(soundBlocks[1]);
var soundBlocks = [crash,happyBeep,whistle];
That's not it. You must:
[ul]
[li]Loop through soundBlocks[/li]
[li]call the playSound() function[/li]
[li]Pass the correct sound from your sound array into it[/li]
[/ul]
TRY AGAIN
for (i=0;i<movementBlocks.length;i++) {
doMovement(movementBlocks[i])
}
for (i=0;i<sounfBlocks.length;i++){
playSound(soundBlocks[i]);
}
soundBlocks[1]=happyBeep;
print(soundBlocks[1]);
var soundBlocks = [crash,happyBeep,whistle];
2
reply
winterscoming
Badges:
19
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#11
Report
#11
(Original post by emmakola)
This code doesn't work are you able to help?
[/font][/size]
[ul]
[li][/font][/size][/li]
[li][/font][/size][/li]
[li][/font][/size][/li]
[/ul]
[/b][/font][/size][/font][/size]
for (i=0;i<movementBlocks.length;i++) {
doMovement(movementBlocks[i])
}
for (i=0;i<sounfBlocks.length;i++){
playSound(soundBlocks[i]);
}
soundBlocks[1]=happyBeep;
print(soundBlocks[1]);
var soundBlocks = [crash,happyBeep,whistle];
This code doesn't work are you able to help?
[/font][/size]
[ul]
[li][/font][/size][/li]
[li][/font][/size][/li]
[li][/font][/size][/li]
[/ul]
[/b][/font][/size][/font][/size]
for (i=0;i<movementBlocks.length;i++) {
doMovement(movementBlocks[i])
}
for (i=0;i<sounfBlocks.length;i++){
playSound(soundBlocks[i]);
}
soundBlocks[1]=happyBeep;
print(soundBlocks[1]);
var soundBlocks = [crash,happyBeep,whistle];
Remember that JavaScript reads things from top-to-bottom just like humans. Think of it like a 'recipe' perhaps; your program is a sequence of instructions which happen in the order you describe them. You can't put icing on a cake before you've mixed the ingredients together and baked it in the oven. The same applies here, if you're using a variable in a program then the variable needs to be created first. Just as with a recipe, sure you always consider the order in which things are happening!
Otherwise, if there are any different problems, it helps to describe what you're seeing (errors/unexpected behaviour) and what you'd expect instead..
1
reply
emmakola
Badges:
8
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#12
(Original post by winterscoming)
You didn't mention the error(s) you're getting, but the obvious problem I can see is that you're attempting to use your soundBlocks array before you've even created it. (The 'var soundBlocks' line is the instruction which actually creates it - until that point it doesn't exist so the lines above that won't work if they try to use it before it exists..)
Remember that JavaScript reads things from top-to-bottom just like humans. Think of it like a 'recipe' perhaps; your program is a sequence of instructions which happen in the order you describe them. You can't put icing on a cake before you've mixed the ingredients together and baked it in the oven. The same applies here, if you're using a variable in a program then the variable needs to be created first. Just as with a recipe, sure you always consider the order in which things are happening!
Otherwise, if there are any different problems, it helps to describe what you're seeing (errors/unexpected behaviour) and what you'd expect instead..
You didn't mention the error(s) you're getting, but the obvious problem I can see is that you're attempting to use your soundBlocks array before you've even created it. (The 'var soundBlocks' line is the instruction which actually creates it - until that point it doesn't exist so the lines above that won't work if they try to use it before it exists..)
Remember that JavaScript reads things from top-to-bottom just like humans. Think of it like a 'recipe' perhaps; your program is a sequence of instructions which happen in the order you describe them. You can't put icing on a cake before you've mixed the ingredients together and baked it in the oven. The same applies here, if you're using a variable in a program then the variable needs to be created first. Just as with a recipe, sure you always consider the order in which things are happening!
Otherwise, if there are any different problems, it helps to describe what you're seeing (errors/unexpected behaviour) and what you'd expect instead..
I'm not good with JavaScript I normally use python. You may like the IDEA Duke of York challenge, if you complete the silver star can you include it on a CV.
0
reply
emmakola
Badges:
8
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#13
(Original post by winterscoming)
You didn't mention the error(s) you're getting, but the obvious problem I can see is that you're attempting to use your soundBlocks array before you've even created it. (The 'var soundBlocks' line is the instruction which actually creates it - until that point it doesn't exist so the lines above that won't work if they try to use it before it exists..)
Remember that JavaScript reads things from top-to-bottom just like humans. Think of it like a 'recipe' perhaps; your program is a sequence of instructions which happen in the order you describe them. You can't put icing on a cake before you've mixed the ingredients together and baked it in the oven. The same applies here, if you're using a variable in a program then the variable needs to be created first. Just as with a recipe, sure you always consider the order in which things are happening!
Otherwise, if there are any different problems, it helps to describe what you're seeing (errors/unexpected behaviour) and what you'd expect instead..
You didn't mention the error(s) you're getting, but the obvious problem I can see is that you're attempting to use your soundBlocks array before you've even created it. (The 'var soundBlocks' line is the instruction which actually creates it - until that point it doesn't exist so the lines above that won't work if they try to use it before it exists..)
Remember that JavaScript reads things from top-to-bottom just like humans. Think of it like a 'recipe' perhaps; your program is a sequence of instructions which happen in the order you describe them. You can't put icing on a cake before you've mixed the ingredients together and baked it in the oven. The same applies here, if you're using a variable in a program then the variable needs to be created first. Just as with a recipe, sure you always consider the order in which things are happening!
Otherwise, if there are any different problems, it helps to describe what you're seeing (errors/unexpected behaviour) and what you'd expect instead..
I'm not good with JavaScript I normally use python. You may like the IDEA Duke of York challenge, if you complete the silver star can you include it on a CV.
0
reply
winterscoming
Badges:
19
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#14
Report
#14
(Original post by emmakola)
Okay I'll change the order and put var soundBlocks at the top
I'm not good with JavaScript I normally use python. You may like the IDEA Duke of York challenge, if you complete the silver star can you include it on a CV.
Okay I'll change the order and put var soundBlocks at the top
I'm not good with JavaScript I normally use python. You may like the IDEA Duke of York challenge, if you complete the silver star can you include it on a CV.
The IDEA thing seems like a good... idea.. to get people interested in writing code, I hope you're enjoying it!
(And thanks, although I already have a job working in JavaScript among other things, but I'm always glad to see things like that to get people interested and learning more about programming

0
reply
emmakola
Badges:
8
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#15
It worked thank you, had to just put all my added code under var soundBlocks.
1
reply
emmakola
Badges:
8
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#16
(Original post by Camanero_An)
what are you meant to do for fuction 2?
what are you meant to do for fuction 2?
lifesSupportCheck()
You've made a mistake on line 8 you've put two }}
Just remove the } from line 8 and keep the one on line 9
Then it should run
0
reply
HorusOG
Badges:
5
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#17
Report
#17
"That's correct how you have done
lifesSupportCheck()
You've made a mistake on line 8 you've put two }}
Just remove the } from line 8 and keep the one on line 9
Then it should run"
Wrong. The engine will not allow for it - you need to perform a specific task. I myself have struggled with this one, because when you follow the instructions it does not even work.
Anyone got answers for how to pass through this part? I really just want to move on at this point, IDEA's coding activities really are not the best sadly.
lifesSupportCheck()
You've made a mistake on line 8 you've put two }}
Just remove the } from line 8 and keep the one on line 9
Then it should run"
Wrong. The engine will not allow for it - you need to perform a specific task. I myself have struggled with this one, because when you follow the instructions it does not even work.
Anyone got answers for how to pass through this part? I really just want to move on at this point, IDEA's coding activities really are not the best sadly.
1
reply
shadhora
Badges:
1
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#18
Report
#18
hello i try to put one of the previous code and i didn't really work could someone help fix it and understand y this doesn't work ??
var soundBlocks = [crash,happyBeep,whistle];
for (i=0;i<movementBlocks.length;i++) {
doMovement(movementBlocks[i])
}
for (i=0;i<soundBlocks.length;i ){
playSound(soundBlocks[i]);
}
soundBlocks[1]=happyBeep;play(soundBlocks[1]);
var soundBlocks = [crash,happyBeep,whistle];
for (i=0;i<movementBlocks.length;i++) {
doMovement(movementBlocks[i])
}
for (i=0;i<soundBlocks.length;i ){
playSound(soundBlocks[i]);
}
soundBlocks[1]=happyBeep;play(soundBlocks[1]);
Last edited by shadhora; 3 years ago
0
reply
Fëær
Badges:
1
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#19
Report
#19
for (i=0;i<movementBlocks.length;i++) {
doMovement(movementBlocks[i])
}
var soundBlocks = [crash,happyBeep,whistle];
for (i=0;i<soundBlocks.length;i++){
playSound(soundBlocks[i])
}
soundBlocks[1]=happyBeep;
print(soundBlocks[1]);
Is this right?
doMovement(movementBlocks[i])
}
var soundBlocks = [crash,happyBeep,whistle];
for (i=0;i<soundBlocks.length;i++){
playSound(soundBlocks[i])
}
soundBlocks[1]=happyBeep;
print(soundBlocks[1]);
Is this right?
0
reply
winterscoming
Badges:
19
Rep:
?
You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#20
Report
#20
(Original post by T X M)
for (i=0;i<movementBlocks.length;i++) {
doMovement(movementBlocks[i])
}
var soundBlocks = [crash,happyBeep,whistle];
for (i=0;i<soundBlocks.length;i++) {
playSound(SoundBlocks[i]);
}
Can someone explain where i went wrong I have tried all methods failing me.
for (i=0;i<movementBlocks.length;i++) {
doMovement(movementBlocks[i])
}
var soundBlocks = [crash,happyBeep,whistle];
for (i=0;i<soundBlocks.length;i++) {
playSound(SoundBlocks[i]);
}
Can someone explain where i went wrong I have tried all methods failing me.
0
reply
X
Quick Reply
Back
to top
to top