/    Sign up×
Community /Pin to ProfileBookmark

java questions

Examine the following function definition:

[code]
function printChars(ch, count) {
var string = “”;
while (count > 0) {
string += ch;
count–;
}
document.write(string + “<BR>”);
}
[/code]

a. Write down exactly the output from the call ‘printChars(“*”, 30)’ as it would appear in a browser.
b. Write a JavaScript loop that uses the defined function to display 10 lines of output in which each line has one more character than its predecessor.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@KorJun 26.2009 — Examine the following function definition:
[/QUOTE]


Examine the lazy student who thinks others will do his homework. :rolleyes:

Let's see what you have coded so far, and only after this sign of benevolence, we might provide an advice. By the way, it looks like you don't even know that [B]java[/B] and [B]javascript[/B] are different languages.
×

Success!

Help @littledan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...