Help with Close browser preventer
Reddit » Learn Javascript
by /u/Josh_Hughes07
2h ago
Was looking into how to stop chrome from closing when multiple tabs are open and found out that wasn't a feature. I did find out that someone made a page that generates a confirmation box to prevent this I am learning how to write JS and have a working version of this page , but it requires that the user had to have been active on the page to generate the dialog box . Was wondering if there is a workaround, or an alternate solution. window.addEventListener("beforeunload", (event) =>{ event.preventDefault(); }); submitted by /u/Josh_Hughes07 [visit reddit] [comments ..read more
Visit website
I want to generate models/schemas from swagger documentations
Reddit » Learn Javascript
by /u/Delicious_Mud284
3h ago
i have a swagger folder where all the .yaml files with the swagger documentations are located. With simple Swagger documentations it works just fine. Here is an example for better understanding: The swagger input: swagger: "2.0" info: title: Your API Title version: 1.0.0 definitions: BatteryAlertModel: type: object properties: loggerId: type: string message: type: string errorCode: type: string timestamp: type: number required: - loggerId - timestamp and this is the correct output: export type BatteryAlertModel = { loggerId: string; message: string; errorCode: string; timestamp: number ..read more
Visit website
The HTML that goes with it
Reddit » Learn Javascript
by /u/RandomBeat111
10h ago
<!DOCTYPE html> <html> <head> <title>Tuxedo Cat Coffee</title> <link type="text/css" href="cafe.css"> <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> </head> <body> <header> <img src="images/logo.png" alt="Tuxedo Cat Coffee"/> </header> <main> <form id="order\_form" name="order\_form" action="checkout.html" method="get"> <section id="menu"> <h2>Menu</h2> <p>Click an item to add it to your order.</p> <ul> <li><a href="#"><img id="image ..read more
Visit website
Search the DOM for an object's key value and return the name of the object
Reddit » Learn Javascript
by /u/3Jay1
11h ago
I have been playing around with this for a bit and can't figure it out. I want to query all of the objects in the DOM, looking through the sets, and when one of the objects of the set in question has a matching key value, I want to return the key value. window.mysteryObj = { obj1:{ abc: 1, def: 2, }, obj2:{ ghi: 3, jkl: 4, } } const keyValue = "ghi" function findMysteryObj (key){ //does some magic return objectName } findMysteryObj(keyValue); // should return "mysteryObj" Is this possible? If someone could put me on the right track that would be amazing! submitted by /u/3Jay1 [visit reddi ..read more
Visit website
The entire code that I need help on
Reddit » Learn Javascript
by /u/RandomBeat111
11h ago
"use strict"; const getSelectedProdcut = src => { let selected = \[\]; if (src == "images/biscotti.jpg") { selected = \["biscotti", 1.95, "Biscotti"\]; } else if (src == "images/cappucino.jpg") { selected = \["cappucino", 3.45, "Cappucino"\]; } else if (src == "images/espresso.jpg") { selected = \["espresso", 1.95, "Espresso"\]; } else if (src == "images/scone.jpg") { selected = \["scone", 2.95, "Scone"\]; } else if (src == "images/latte.jpg") { selected = \["latte", 2.95, "Latte"\]; } else if (src == "images/coffee.jpg") { selected = \["coffee", 1.75, "Coffee"\]; } return selected ..read more
Visit website
This video player isn't allowing full screen (only on Chrome)
Reddit » Learn Javascript
by /u/Internet_Eye
13h ago
I’ve been having an issue with a video player on a certain website (here’s the link). The player refuses to go full screen (only on Chrome, works fine on Firefox) when I click its full screen button. I’ve also tried using a bookmarklet to force it into full screen mode, but that didn’t work either. I don’t have the coding skills to investigate this issue myself. I thought this could be an interesting problem for those of you who enjoy debugging or solving these kinds of issues. submitted by /u/Internet_Eye [visit reddit] [comments ..read more
Visit website
Complex user interactions tutorials/books/content
Reddit » Learn Javascript
by /u/LoliInTheNight
13h ago
Could you please advise anything to read/watch that helped you understand how to build complex user interactions? For example inputs that have to change selection a lot because of mappings/masks/formatting/etc, drag and drops with additional features like sticking to other objects, multiple sources of scroll change, anything like that. Right now I'm trying to build a floor editor using canvas, pixijs and rxjs and I constantly feel like everything is falling apart and it's not the first time I struggle with this kind of things. submitted by /u/LoliInTheNight [visit reddit] [comments ..read more
Visit website
Do sparse arrays have missing indexes or just missing values?
Reddit » Learn Javascript
by /u/dlrace
17h ago
Hello, Analogous to an object, if i try to access a property that is non-existent, a value of undefined will be returned, essentially meaning that no such property exists. Is this the same for sparse arrays? under the hood, is the index of a hole itself missing, even if it's value and 'existence' is implied by the nature of array order, or is the array populated with indexes but just no value is assigned (kind of like an uninitialized variable). using 'in' and 'hasownproperty', which return false for a index at a given hole, seem to imply its the index missing itself. Many thanks. submitted ..read more
Visit website
Hey, i'm starting to learn js, do you guys have any advice?
Reddit » Learn Javascript
by /u/bald-one-26
19h ago
Recently i started exploring the world of front-end development. I'm studying html, css and javascript. I hope to get a job soon. I would really appreciate any advice you guys could give me on my learning journey :) submitted by /u/bald-one-26 [visit reddit] [comments ..read more
Visit website
Need help putting information from JavaScript into an HTML section
Reddit » Learn Javascript
by /u/RandomBeat111
20h ago
$(document).ready(() => { let total = 0; //This is where you add the oldURL and newURL $("ul img").each( (index, img) => { //get the src attributes const oldURL = img.src; const newURL = img.id; $(img).mouseover(() => img.src = img.id); $(img).attr("src"); $(img).mouseout(() => img.src = oldURL); $(img).attr("id"); //get the id attribute //preload rollover Image const rolloverImage = new Image(); rolloverImage.src = newURL; //set up event handlers $(img).hover( () => $(img).attr("src", newURL), () => $(img).attr("src", oldURL) );//end hover $(img).click(evt => { //get d ..read more
Visit website

Follow Reddit » Learn Javascript on FeedSpot

Continue with Google
Continue with Apple
OR