Skip to content

Instantly share code, notes, and snippets.

@RameshRM
Last active January 1, 2016 03:31
Show Gist options
  • Save RameshRM/876e6592d26c978b6426 to your computer and use it in GitHub Desktop.
Save RameshRM/876e6592d26c978b6426 to your computer and use it in GitHub Desktop.
function wordcount(paragraph) {
var totalSpaces = 0;
var letter;
for (var i = 0; i < paragraph.length; i++) {
letter = paragraph.substr(i, 1);
if (letter === ' ') {
totalSpaces = totalSpaces + 1;
}
}
return totalSpaces+1;
}
console.log('Total Words: ' , wordcount('I’m most proud of my confidence and perseverance. What I mean is, I’m confident when I’m trying new things. I don’t think of failing, but I think about success and how I could succeed in what I’m doing. I also persevere through things. When I fail, I don’t give up. I try over and over again, until I succeed. My confidence helps me in my daily life. It helps me because when I learn something new each day, I learn it with ease because I’m carefree. This helps me not only learn new things but also have fun while learning. If I don’t have confidence while learning new things, I probably never will learn something new out of fear of failing. Perseverance also helps me in my daily life. WHen I fail, I don’t give up, but I fix my mistakes and try again. An example is when I was trying to make a writerbot out of my EV3 Mindstorm Lego set. When I put the medium motor next to the large motors, the pencil kept hitting the wheels connected to the large motors. I kept trying, and finally I got the idea of making an extension from the NXT and it worked. And I’m still brainstorming ideas to make the pencil lift up, for I can’t write multiple letters at once. As you can see, I probably never would have even made it past the stage where the pencil was hitting the large motor if I didn’t persevere.'));
console.log('Total Words: ' , wordcount('A time I failed was in the Problem of the Week in math. The question was: What is the least number that has a remainder of one when divided into 2, 3, 4, 5, and 6 but is divisible by 7? I did the work, but I forgot to check if it was divisible by 7.The results came back. I thought that there must be a mistake. But no, it was mine all right. Only then did I check my answer. Then and there, I learned my lesson. That day instantly became one of my worst days ever, but from then on, I never ceased to check my work. Now, when I just want to be done with my work, I always remember the Problem of the Week, and I find myself not double-checking but triple-checking my work. Checking my work always pays of and gives me a present grade-wise. Although the day I received the results for the Problem of the Week is still one of my worst days ever, I sometimes feel thankful that I made a mistake because if that had never happened, I would still cease to check my work, and I would have NEVER learned my lesson.'));
console.log('Total Words: ', wordcount('An ideal team is productive not because of one person’s work but because of everybody’s work. Everybody on a team is vital to their team. The ideal team isn’t perfect; they do have controversies. But the team works them out, instead of arguing. The team also looks organized. Their work isn’t just all over the place but organized so that they can be accessed when necessary. The various roles of an ideal team are the facilitator, the materials manager, the harmonizer, and the reporter. Everybody has a vital role. For example, the facilitator leads the group and tells his/her group what to do. The facilitator should be open to other people’s ideas. If he doesn’t, he isn’t a good facilitator and should be replaced by someone else. The same goes for every other role, too; if they aren’t doing their roles properly, they should be replaced. The materials manager is in charge of the materials. He/she gets the materials and makes sure his/her group has what they need. The harmonizer makes sure the group doesn’t argue. In other words, the harmonizer solves the group’s problems. The reporter reports out what his/her group did. He/she pays careful attention to what’s happening and helps or gives suggestions whenever he can. As for what role I can see myself playing, it’s facilitator. I have good leadership qualities and am full of ideas. Also I am always on task and make other people pay attention to what’s happening. This is why I can see myself playing a good facilitator.'));
console.log('Total Words:' , wordcount('A time I failed was in the Problem of the Week in math. The question was: What is the least number that has a remainder of one when divided into 2, 3, 4, 5, and 6 but is divisible by 7? I did the work, but I forgot to check if it was divisible by 7.The results came back. I thought that there must be a mistake. But no, it was mine all right. Only then did I check my answer. Then and there, I learned my lesson. That day instantly became one of my worst days ever, but from then on, I never ceased to check my work. Now, when I just want to be done with my work, I always remember the Problem of the Week, and I find myself not double-checking but triple-checking my work. Checking my work always pays of and gives me a present grade-wise. Although the day I received the results for the Problem of the Week is still one of my worst days ever, I sometimes feel thankful that I made a mistake because if that had never happened, I would still cease to check my work, and I would have NEVER learned my lesson.'));
function value(word) {
var word;
console.log(word);
var A=1;
var B=2
var C=3
var D=4
var E=5
var F=6
var G=7
var H=8
var I=9
var J=10
var K=11
var L=12
var M=13
var N=14
var O=15
var P=16
var Q=17
var R=18
var S=19
var T=20
var U=21
var V=22
var W=23
var X=24
var Y=25
var Z=26
console.log(word.length)
// console.log(A+N+Y);
var letter;
for(letter=0;letter<word.length;letter++) {
// console.log('letter');
// console.log('AZHAGESWARI')
// console.log("letter is", letter.charat());
// console.log (word.(charat)
// console.log (letter);
console.log (letter,word.charAt(letter));
}
}
value('AZHAGESWARI')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment