Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
that's part of my script:
var count = $(".sliderItem").length;
if (count < lp + 5)
{
alert("bp4");
var clips = count-l;
alert("bp5");
}
so the problem is: 'bp4' is visible but 'bp5' not.
when I change var clips = count-1; to var clips = 1; it works fine.
Somebody have some idea?
You don't have var clips = count-1; in your code, you have var clips = count-l;.
Change the letter l (lower case L) to 1 in your code.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
Try printing stars in the following format for n rows.
*
**
for n times
let n = 4;
for (let i = 0; n >= i; i++) {
console.log('*'.repeat(i))
}
Something like this should help you. Please ensure to read contribution guidelines and maybe show what you've tried. This is a simple implementation which should help you.
Good luck!
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
How to do that witn Pure JavaScript?
I need clear code or just guidelines.
From what I gathered from your question this what I believe you need. Hopefully it will get you going in the right direction.
var textAreaID = "user-input";
//turn the text area content into an array
var content = document.getElementById(textAreaID).innerHTML.split("\n");
//create array to hold new Content
var newContent = [];
//loop through and add line numbers
for (var i = 0; i < content.length; i++) { //begin for loop
//append the line numbers and the new value to the newContent array
newContent.push((i + 1) + content[i] + "\n");
} //end for loop
//update the content of textArea with line numbers
document.getElementById(textAreaID).innerHTML = newContent.join("");
<textarea id="user-input" name="user-input" rows="15" cols="40">
Hello is it working?
I think so.
</textarea>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I want to randomly generate a number between 1 and 10 and also display it on a webpage, does anyone have any idea how i'd go about doing this?
preferably in full since i have no idea what im doing
C'mon man. Google something. jsfiddle
var min = 1, max = 10,
num = Math.floor(Math.random() * (max - min + 1)) + min;
document.body.innerHTML = num;
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Can someone please tell me how to compare elements in array with every other element. I mean in array arr = [a,b,c,d];, I would like to compare a with b,c,d , b with a,c,d, etc. And to do that dynamically, no mather of the size of the array.
Try this:
var a=["a","b","c","d"];
for(var i=0;i<a.length;i++){
for(var j=0;j<a.length;j++){
if(i!=j && a[j]===a[i]){
//match, do whatever you want
}
}
}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I'm currently starting to learn Javascript and would be grateful for some help with the following issue:
I'm trying to make a loop that writes a new line with a base value that adds by 1 with each line until the value is equal to 10. Basically, it's supposed to look like this:
Answer: 1
Answer: 2
Answer: 3
... and so on, until it reaches 10. There' the loop should end.
How do I achieve this?
Easy solution. Do not use in anything serious:
for (x=1;x<11;x++)
{
document.write("Answer: "+x+"<br />");
}
More versatile solution with DOM (fiddle):
<p id="numbers">
</p>
<script type="text/javascript">
for (x=1;x<11;x++)
{
document.getElementById("numbers").innerHTML+="Answer: "+x+"<br />"
}
</script>
Use a for loop like so:
for(var x = 1; x <= 10; x++) //start x as equal to one, run the code, and repeat until x is 10
console.log("Answer: " + x);//Print x