![Briyan](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-08-30%2F7667350697905_06d9e666e5b6462b8bad_192.jpg&w=96&q=75)
![js emoji](/_next/image?url=https%3A%2F%2Femoji.slack-edge.com%2FT0266FRGM%2Fjs%2F0772a31af766713b.png&w=96&q=75)
Posts tagged with :js:
![Briyan](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-08-30%2F7667350697905_06d9e666e5b6462b8bad_192.jpg&w=96&q=75)
![MichaelChuang](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F778526dcd6bebe9f06dd97244ba29a4f.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0011-192.png&w=96&q=75)
![MatthewSoh](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-23%2F7451054227639_75d8f9a275537c2367a9_192.png&w=96&q=75)
![Jeremy](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F5b68107ce88c7b4f00ea50b961be7d67.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0026-192.png&w=96&q=75)
i
for a debug menu! (Note: most of the lag is out of my control, the sprig emulator has iffy performance. Hopefully I can get it working on a real sprig!)
Play: sprig.hackclub.com/share/zqNUQdjMUesAvefyCHnK
Code: github.com/jeremy46231/sprig/blob/2f9116/games/off-grid-platformer.js![MatthewSoh](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-23%2F7451054227639_75d8f9a275537c2367a9_192.png&w=96&q=75)
![Tejas](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F36156c389c3545d58f6f590da9049842.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0010-192.png&w=96&q=75)
![Yash](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-29%2F7488040266149_ade44c1c6dcd400b4290_192.png&w=96&q=75)
![PratyushChaudhary](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-13%2F7418133545251_78e443f45a9fcb0a5500_192.jpg&w=96&q=75)
![AdityaPV](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2023-12-04%2F6272330539799_3542b03515bf7256938b_192.jpg&w=96&q=75)
![Gus](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-08-03%2F7536446807137_a25c5d014c6dc8d67e3b_192.png&w=96&q=75)
![Jignesh](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F592735912461983b716dbeeef4970f72.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0026-192.png&w=96&q=75)
![tippfehlr](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-08-13%2F7566523455299_a93ae8d7cb258d71edbe_192.jpg&w=96&q=75)
![Tejas](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F36156c389c3545d58f6f590da9049842.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0010-192.png&w=96&q=75)
![Tejas](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F36156c389c3545d58f6f590da9049842.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0010-192.png&w=96&q=75)
![Tejas](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F36156c389c3545d58f6f590da9049842.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0010-192.png&w=96&q=75)
![Tejas](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F36156c389c3545d58f6f590da9049842.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0010-192.png&w=96&q=75)
![Tejas](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F36156c389c3545d58f6f590da9049842.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0010-192.png&w=96&q=75)
![Tejas](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F36156c389c3545d58f6f590da9049842.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0010-192.png&w=96&q=75)
![Tejas](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F36156c389c3545d58f6f590da9049842.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0010-192.png&w=96&q=75)
![Anson-U07FPDRVCD8](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F2d2de7e3ff008e7944da1d0b6b1273e0.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0017-192.png&w=96&q=75)
![JBBurns](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fdcb6482905bbd73a69efd693c5c99d1a.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0009-192.png&w=96&q=75)
![Malav](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-09-03%2F7675642904660_f1b85f7e2264b5bc880b_192.png&w=96&q=75)
![David-U07BCKM3MT8](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-11%2F7405873239746_313819042a123fbdbf05_192.jpg&w=96&q=75)
![Emiliano](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F7b3375f5a0ec02af72c7cc189a670e51.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0015-192.png&w=96&q=75)
![Mish](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-14%2F7405791725447_c793b3c043c7d860fe34_192.png&w=96&q=75)
![pepperjack](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-06-18%2F7295072377779_06ab236816b1e5798cd6_192.jpg&w=96&q=75)
![PankajKumar](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-08-02%2F7517810544805_5de053108d2bee37d4af_192.jpg&w=96&q=75)
![EzioAuditoreDeFinerze](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-05%2F7404872982448_19e51bd9847014bba101_192.jpg&w=96&q=75)
![Ryleigh](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-06-28%2F7350805192451_186f7ce3302dee948b38_192.png&w=96&q=75)
![Ryleigh](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-06-28%2F7350805192451_186f7ce3302dee948b38_192.png&w=96&q=75)
![David-U07BCKM3MT8](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-11%2F7405873239746_313819042a123fbdbf05_192.jpg&w=96&q=75)
![David-U07BCKM3MT8](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-11%2F7405873239746_313819042a123fbdbf05_192.jpg&w=96&q=75)
![Carterpfaff](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Ffd9306d4cb43a583b80eadcb7eb6c560.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0001-192.png&w=96&q=75)
![NiceSapien](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F80651ce7505380bd074363ce67db56bd.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0010-192.png&w=96&q=75)
![AbdelrahmanIbrahimAbuessa](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-03-01%2F6729891837394_1084a22e25a4a7b6892f_192.jpg&w=96&q=75)
![TanushChauhan](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-08-28%2F7659513491521_81f3f75cd5e31c67110f_192.png&w=96&q=75)
![Nicsfish](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-08-09%2F7545146459094_a920d5699784b7371d9a_192.png&w=96&q=75)
![TanushChauhan](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-08-28%2F7659513491521_81f3f75cd5e31c67110f_192.png&w=96&q=75)
![ArabiSayed](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-09%2F7409203663025_403630073debd70ff56c_192.png&w=96&q=75)
![LuisAFK](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fb2429910542e0c30fde2a0a336c98bbf.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0014-192.png&w=96&q=75)
function y(b){return(b-32)*5/9}function z(b){return b*9/5+32}function A(b){return b-273.15}function B(b){return b+273.15}for await(let b of console){if(!b||b==="exit")break;const[,q,w,x]=b.match(/(\d+(?:\.\d+)?)\s*([fkc])\s*(?:in|to)\s*([fkc])/i)||[];if(!q||!w||!x){console.log("Invalid input");continue}const j=parseFloat(q);let g;switch(w.toLowerCase()+x.toLowerCase()){case"fc":g=y(j);break;case"cf":g=z(j);break;case"kc":g=A(j);break;case"ck":g=B(j);break;default:console.log("Invalid conversion");continue}console.log(g)} Into this: function convertFahrenheitToCelsius(fahrenheitTemperature) { return ((fahrenheitTemperature - 32) * 5) / 9; } function convertCelsiusToFahrenheit(celsiusTemperature) { return (celsiusTemperature * 9) / 5 + 32; } function convertKelvinToCelsius(kelvinTemperature) { return kelvinTemperature - 273.15; } function convertCelsiusToKelvin(celsiusTemperature) { return celsiusTemperature + 273.15; } for await (let consoleLogEntries of console) { if (!consoleLogEntries || consoleLogEntries === "exit") break; const [, temperatureValue, matchedTemperatureValue, matchedTemperature] = consoleLogEntries.match( /(\d+(?:\.\d+)?)\s*([fkc])\s*(?:in|to)\s*([fkc])/i, ) || []; if (!temperatureValue || !matchedTemperatureValue || !matchedTemperature) { console.log("Invalid input"); continue; } const parsedTemperature = parseFloat(temperatureValue); let g; switch ( matchedTemperatureValue.toLowerCase() + matchedTemperature.toLowerCase() ) { case "fc": g = convertFahrenheitToCelsius(parsedTemperature); break; case "cf": g = convertCelsiusToFahrenheit(parsedTemperature); break; case "kc": g = convertKelvinToCelsius(parsedTemperature); break; case "ck": g = convertCelsiusToKelvin(parsedTemperature); break; default: console.log("Invalid conversion"); continue; } console.log(g); }
![PratyushChaudhary](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-13%2F7418133545251_78e443f45a9fcb0a5500_192.jpg&w=96&q=75)
![PratyushChaudhary](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-13%2F7418133545251_78e443f45a9fcb0a5500_192.jpg&w=96&q=75)
![JubilantMarmot](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F1a1b22234259dc40669573a2824ab9f6.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0011-192.png&w=96&q=75)
![EXELVI](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F1ffee063e9dcb28936ba4bc71ce09834.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0019-192.png&w=96&q=75)
![elliott](/_next/image?url=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F90e85a1f6bf6f7f89d83567a280c82ed.jpg%3Fs%3D192%26d%3Dhttps%253A%252F%252Fa.slack-edge.com%252Fdf10d%252Fimg%252Favatars%252Fava_0006-192.png&w=96&q=75)
![idksarah](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-19%2F7445516483014_844c09c8484a60254d4b_192.jpg&w=96&q=75)
![MatthewSoh](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-07-23%2F7451054227639_75d8f9a275537c2367a9_192.png&w=96&q=75)
![Niyaz](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-09-02%2F7661428891442_b964543321c9806c5e38_192.png&w=96&q=75)