এটি কোনও চ্যালেঞ্জ নয়, তবে একটি প্রশ্ন, আমি অনুভব করেছি যে এটি কারণে ছিল
প্রোগ্রামিং ধাঁধা সমাধানের সাথে সম্পর্কিত বা একটি নির্দিষ্ট ধরণের চ্যালেঞ্জ সম্পর্কিত নন-চ্যালেঞ্জ প্রশ্নগুলিও বিষয়টিতে রয়েছে।
এখন প্রশ্ন:
জাভা স্ক্রিপ্ট কোডটি কি কেবল 5 টি অক্ষর দিয়ে লেখা সম্ভব? জেএসফাক ইতিমধ্যে 6 টি চিহ্ন সহ এটি করেছে !+[]()
তবে আমি ভাবছি !
চরিত্রটির প্রয়োজন আছে কিনা।
জেএসফাক স্ট্রিংয়ে কাস্টিংয়ের সংমিশ্রণ (একটি ফাঁকা অ্যারে যোগ করে), সংখ্যায় কাস্টিং (সামনের দিকে + লিখে) এবং অবহেলা করে বুলিয়ানে কাস্টিংয়ের কাজ করে। উদাহরণ স্বরূপ:
[] \\ Empty array
+[] \\ Cast to number -> 0
!+[] \\ Negate -> true
!+[]+[] \\ Cast to string -> "true"
এই স্ট্রিং থেকে আমরা এর ভিতরে থাকা একটি সংখ্যার সাথে বর্গাকার বন্ধনী ব্যবহার করে এর সমস্ত অক্ষর বের করতে পারি এবং যে কোনও সংখ্যা বহুবার একসাথে সত্য যুক্ত করে তৈরি করা যায়।
এটির মতো প্রচুর অক্ষর পাওয়া যাবে এবং স্ট্রিংগুলিতে সংমিশ্রিত হতে পারে। তৈরি করতে সক্ষম হওয়া সর্বাধিক গুরুত্বপূর্ণ স্ট্রিংটি হ'ল "constructor"
এটি Function
কোনও ফাংশন থেকে পাওয়ার জন্য ব্যবহার করা যেতে পারে এবং জাভাস্ক্রিপ্ট হিসাবে এই স্ট্রিংটি স্ট্রিংগুলি কার্যকর করতে ব্যবহার করা যেতে পারে:
[]["find"] \\ the function Array.prototype.find
[]["find"]["constructor"] \\ the Function object
[]["find"]["constructor"](string)() \\ same as eval(string)
আপনি দেখতে পাচ্ছেন, !
এখানে 2 টি ব্যবহার রয়েছে:
- স্ট্রিং থেকে বর্ণ নির্বাচন করতে সংখ্যা তৈরি করা হচ্ছে।
- বুলিয়ান পেতে কাস্টিং
"true"
এবং"false"
।
এই 2 ++
টির মধ্যে প্রথমটি সরাসরি ইনক্রিমেন্টার ব্যবহার করেও করা 0
যেতে পারে, তবে এটি অ্যারের অভ্যন্তরের উপাদানগুলিতে ব্যবহার করা যেতে পারে:
+[] \\ 0
[+[]] \\ [0]
[+[]][+[]] \\ [0][0] -> 0
++[+[]][+[]] \\ ++[0][0]-> 1
++[[]][+[]] \\ also works because ++ casts to number
সুতরাং সমস্ত সংখ্যা ছাড়া তৈরি করা যেতে পারে !
।
দ্বিতীয়টি আরও কঠিন। গুরুত্ব "true"
এবং "false"
অক্ষরে টিম সীমানা "r"
এবং "s"
, যা উভয় প্রদর্শিত "constructor"
। আমি ইতিমধ্যে সব অন্য অক্ষর পাওয়া যায় "constructor"
মাধ্যমে "undefined"
, "Infinity"
, "NaN"
এবং স্ট্রিং ফাংশন কাস্ট করে।
সুতরাং চূড়ান্ত প্রশ্ন: (কীভাবে) আপনি কেবল ব্যবহার করে বুলিয়ান বা বর্ণগুলি "r"
এবং "s"
জাভাস্ক্রিপ্টে তৈরি করতে পারেন +[]()
?
চিঠিটিও "l"
সাহায্য করতে পারে। এটি ফর্মটি পাওয়া যেতে পারে null
তবে আমি সেই 5 টি চিহ্নের সাথে সেই মানটি পেতে সক্ষম হইনি। উদাহরণস্বরূপ, এটি ইতিমধ্যে আমাদের কাছে থাকলে বুলিয়ানগুলি পেতে ব্যবহার করা যেতে পারে "s"
:
[]["includes"]() \\ false
[+[]]["includes"](+[]) \\ true
চিঠিটি "l"
এবং "k"
একসাথে এতে প্রবেশাধিকার দেবে "r"
:
([]+[])["link"]() \\ "<a href="undefined"></a>"
বুলিয়ান পাওয়ার কোনও উপায়, null
বা কোনও চিঠিই r s l k
খুব কার্যকর হবে!
আমাদের যা আছে তার একটি গ্রন্থাগার:
অ্যারে.প্রোটোটাইপ.ফাইন্ড: [] [[([[] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++, [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[]] []) [(++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + ( ++, [[]] [[]])]) + + (([] [[]] []) [++, [[]] [[]]]) + + (([] [[]] []) [(++, [[]] [[]]) + + (++, [[]] [[]])])] অনন্ত: + ((++ [[]] [+ []] + []) + (([[] [[]] + []) [(++ [[]] [+ []]) + (+ [[]] [[]]) + + (++, [[]] [[]])]) + + (++, [[]] [[]] []) + + ([]) + + ([]) + + (+, [])) নাএন: + [] [[]] অপরিবর্তিত: [] [[]] 0: + [] 1: ++ [[]] [+ []] 2: (++ [[]] [+ []]) + (++ [[]] [+ []]) 3: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) 4: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] ] [[]]) 5: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] ] [[]]) + + (++, [[]] [[]]) 6: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] ] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) 7: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] ] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) 8: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] ] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) 9: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] ] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) এ: (+ [] [[]] + []) [++ [[]] [+ []] সি: ([] [([[[] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[]] []) [(++, [[]] [[ ]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [ []] [[]])]) + + (([] [[]] []) [++, [[]] [[]]]) + + (([] [[]] [] ) [(++, [[]] [[]]) + + (++, [[]] [[]])])] []) [(++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])] ডি: ([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []])] ই: ([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [ []])] চ: ([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [ []]) + + (++, [[]] [[]])] আমি: ([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [ []]) + + (++, [[]] [[]]) + + (++, [[]] [[]])] এন: ([] [[]] + []) [++ [[]] [+ []] ও: ([] [(([[] [[]] + []) [[++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[]] []) [(++, [[]] [[ ]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [ []] [[]])]) + + (([] [[]] []) [++, [[]] [[]]]) + + (([] [[]] [] ) [(++, [[]] [[]]) + + (++, [[]] [[]])])] []) [(++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])] টি: (+ ((++ [[]] [+ []] + []) + (([[] [[]] + []) [(++ [[]] [+ []]) + ( ++, [[]] [[]]) + + (++, [[]] [[]])]) + + (++, [[]] [[]] []) + + (+, [] ) + + ([]) + + (+, [])) []) [(++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[] ])] আপনি: ([] [[]] + []) [+ []] ভি: ([] [(([[] [[]] + [])] [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[]] []) [(++, [[]] [[ ]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [ []] [[]])]) + + (([] [[]] []) [++, [[]] [[]]]) + + (([] [[]] [] ) [(++, [[]] [[]]) + + (++, [[]] [[]])])] []) [(++, [[]] [[]]) + + (++, [[]] [[]]) [] ((++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]))] y: (+ ((++ [[]] [+ []] + []) + (([[] [[]] + []) [(++ [[]] [+ []]) + ( ++, [[]] [[]]) + + (++, [[]] [[]])]) + + (++, [[]] [[]] []) + + (+, [] ) + + ([]) + + (+, [])) []) [(++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[] ]) + + (++, [[]] [[]])] আমি: (+ ((++ [[]] [+ []] + []) + (([[] [[]] + []) [(++ [[]] [+ []]) + ( ++, [[]] [[]]) + + (++, [[]] [[]])]) + + (++, [[]] [[]] []) + + (+, [] ) + + ([]) + + (+, [])) []) [[]] এন: (+ [] [[]] + []) [+ []] "": ([] [([[] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (+ [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[]] []) [(++, [[]] [+ + []]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[]] []) [++, [[]] [[]]]) + + (([] [[]] [ ]) [(++, [[]] [[]]) + + (++, [[]] [[]])])] []) [+ + (++, [[]] [[] ] [] ((++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (+ + [[]] [[]]) + + (++, [[]] [[]])))] (: ([] [(([[] [[]] + [])] [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[]] []) [(++, [[]] [[ ]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [ []] [[]])]) + + (([] [[]] []) [++, [[]] [[]]]) + + (([] [[]] [] ) [(++, [[]] [[]]) + + (++, [[]] [[]])])] []) [+ + (++, [[]] [[]] [] ((++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])))] ): ([] [([[] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[]] []) [(++, [[]] [[ ]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [ []] [[]])]) + + (([] [[]] []) [++, [[]] [[]]]) + + (([] [[]] [] ) [(++, [[]] [[]]) + + (++, [[]] [[]])])] []) [+ + (++, [[]] [[]] [] ((++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])))] {: ([] [(([[] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[]] []) [(++, [[]] [[ ]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [ []] [[]])]) + + (([] [[]] []) [++, [[]] [[]]]) + + (([] [[]] [] ) [(++, [[]] [[]]) + + (++, [[]] [[]])])] []) [+ + (++, [[]] [[]] [] ((++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])))] }: ([+] [(([[] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[]] []) [(++, [[]] [[ ]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [ []] [[]])]) + + (([] [[]] []) [++, [[]] [[]]]) + + (([] [[]] [] ) [(++, [[]] [[]]) + + (++, [[]] [[]])])] []) [+ + ((++, [[]] [[] ]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) [] ((++, [[]] [[]]) + + ( ++, [[]] [[]])))] ।: (+ (++ [[]]] [+ []] + [] + (++ [[]] [+ []]) + ([]] [[]] + []) [(++ [ []] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])] (++, [[]] [[] ] [] ([]) + + ([]))) []) [++, [[]] [[]]] :[[]] [([] [(([] [[]] []) [(++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[]] []) [(++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + ( ++, [[]] [[]])]) + + (([] [[]] []) [++, [[]] [[]]]) + + (([] [[]] []) [(++, [[]] [[]]) + + (++, [[]] [[]])])] []) [(++, [[]] [[ ]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])] ([] [(([] [[]] []) [ (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [ []])]) + + (([] [[]] []) [(++, [[]] [[]]) + + (++, [[]] [[]]) + + ( ++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[] ] []) [++, [[]] [[]]]) + + (([] [[]] []) [(++, [[]] [[]]) + + (++, [[]] [[]])])] []) [(++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [ []] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]] )] ([] [[]] []) [++, [[]] [[]]] ([] [(([] [[]] []) [(++, [[ ]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) ]) + + (([] [[]] []) [(++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[] ] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])]) + + (([] [[]] []) [++, [[]] [[]]]) + + (([] [[]] []) [(++, [[]] [[]]) + + (++, [[]] [ []])])] []) [(++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])] (+, [] [[]] []) [++, [[]] [[]]] (+ + ((++, [[]] [[]] []) + + (([] [[]] []) [(++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]])]) + + ( ++, [[]] [[]] []) + + ([]) + + ([]) + + (+, [])) []) [(++, [[]] [[] ]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[]] [[]]) + + (++, [[ ]] [[]]) + + (++, [[]] [[]])]] ([[]]) +, []
eval
সহ 2453 অক্ষর পেয়েছি window
।