Question

Javascript Provide the code to add the custom dropRank() method to the pokerCard object that changes...

Javascript

Provide the code to add the custom dropRank() method to the pokerCard object that changes the value of the rank property to "Queen". (Hint: Create the dropRank() function and use the this keyword to reference the current object.)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Specification of question is not very clear

<!DOCTYPE html>
<html>
<body>
<script>
function dropRank(){

val=document.getElementById("jack").value; //get the value of current element
document.getElementById("jack").value="Queen" //now set it new value queen

}
</script>
<p>
<input type="text" id="jack" value="jack" readonly>
<button type="button" value="Jack" onclick="dropRank();"> Drop tank</button>
</p>
<!--on click call DropRank()-->


</body>
</html>

Add a comment
Know the answer?
Add Answer to:
Javascript Provide the code to add the custom dropRank() method to the pokerCard object that changes...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Javascript Provide code to create a custom object named pokerCard containing the suit property with a...

    Javascript Provide code to create a custom object named pokerCard containing the suit property with a value of "Spades" and a rank property with a value of "King".

  • True/False 1. Browser-based validation can replace the need to write custom JavaScript code to validate user...

    True/False 1. Browser-based validation can replace the need to write custom JavaScript code to validate user input. 2. When you add a new property to an object that has been instantiated from a constructor function, the new property is available to all objects instantiated from the same constructor function. 3. Because objects in the browser object model are actually part of the web browser, you do not need to instantiate them in order to use them in your programs. 4....

  • code 3 different ways to insert a property-value pairing into a javascript object where the object...

    code 3 different ways to insert a property-value pairing into a javascript object where the object name is Seneca, the property name is coursecode and the value is WEB322

  • JavaScript expert, I need your help : My program doesn't work. I have the following program,...

    JavaScript expert, I need your help : My program doesn't work. I have the following program, it is simple web page: Create an object called person with name = John, age = 50. Then, access the object to display "John is 50 years old”. I have written some code here. Hint: Create an object with the var keyword, followed by a name and an "=" sign. Put the properties and values inside the {}; signs Note: Use getElementById() and innerHTML...

  • This is my code so far: <!DOCTYPE html> <html> <head> <title>JavaScript is fun</title> <meta charset="utf-8" />...

    This is my code so far: <!DOCTYPE html> <html> <head> <title>JavaScript is fun</title> <meta charset="utf-8" /> </head> <body> <script type ="text/javascript"> //declare a variable and store text in it var x = "JavaScript is fun"; //write the variable 5 times document.write(x + x + x + x + x); //store 5 as string in variable x x = "5"; //store 3 as string in variable y var y = "3"; //write the value x + y to the document document.write("<br>");...

  • Fake News This exercise is about modifying the content of a page in your web browser using Javascript. As we have said, Javascript has access to the current page via the Document Object Model or DOM....

    Fake News This exercise is about modifying the content of a page in your web browser using Javascript. As we have said, Javascript has access to the current page via the Document Object Model or DOM. In your browser, the variable document represents the current document and your code can use it to read and write to the current page. In this exercise we will use the developer tools Javascript console to write Javascript to access parts of the main...

  • only in javascript 1.Define a method named roleOf that takes the name of an actor as...

    only in javascript 1.Define a method named roleOf that takes the name of an actor as an argument and returns that actor's role. Ex: roleOf("Keira Knightley") returns "Elizabeth Swann". Hint: A method may access the object's properties using the keyword this. Ex: this.cast accesses the object's cast property. var movie = { // Code will be tested with different actors and movies name: "Pirates of the Caribbean: At World's End", director: "Gore Verbinski", composer: "Hans Zimmer", cast: { "Johnny Depp":...

  • Need a Javascript program for an Employee class with a Constructor Function. It must contain properties...

    Need a Javascript program for an Employee class with a Constructor Function. It must contain properties of name, annualsalary and bonus of multiple employee of a company. It should contain a Method for calculateBonus. The bonus will be 20% of annualsalary. When the calculateBonus method is called, the bonus should be returned as the bonus's return value. Create a Function Called checkEmployee(). This Function when called will instantiate an employee Object Will Call the Employee's calculateBonus Method and when the...

  • JavaScript C13 Question 1 (1 point) Which property of the Number object returns the largest positive...

    JavaScript C13 Question 1 (1 point) Which property of the Number object returns the largest positive value that JavaScript can represent? Question 1 options: MIN_VALUE MAX_VALUE POSITIVE_INFINITY NEGATIVE_INFINITY Save Question 2 (1 point) If a numerical operation returns a number greater than the largest possible JavaScript value, it returns Question 2 options: NaN -NaN Infinity -Infinity Save Question 3 (1 point) In JavaScript, NaN represents Question 3 options: a value that isn’t a number the largest positive value that can...

  • javascript

    In this project you will write the JavaScript code to create a calculator. Good thing is that everyone knows how the calculator works. It is a challenging project, give yourself lots of time to complete it.1. You are provided with an HTML, and CSS files.. Look at these files to understandhow to use them and modify them if needed based on your code. (Note: You can adddifferent selector (id, class) in HTML ONLY and cannot make any changes to CSS.)Create...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT